v2.6.34.8 longterm review
Subsystems (108)
cover v2.6.34.8 longterm review
This is the start of the longterm review cycle for the v2.6.34.8 release. There are 260 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Reponses should be made within 72 hours.
Al Viro (1):
arm: fix really nasty sigreturn bug
Alan Cox (1):
bluetooth: Fix missing NULL check
Alan Stern (3):
USB: fix bug in initialization of interface minor numbers
USB: disable endpoints after unbinding interfaces, not before
USB: accept some invalid ep0-maxpacket values
Alexey Kuznetsov (1):
tcp: Prevent overzealous packetization by SWS logic.
Alok Kataria (1):
x86, kexec: Make sure to stop all CPUs before exiting the kernel
Alon Ziv (1):
USB: opticon: Fix long-standing bugs in opticon driver
Anders Larsen (1):
USB: cp210x: Add WAGO 750-923 Service Cable device ID
Andre Przywara (1):
x86, cpu: Fix renamed, not-yet-shipping AMD CPUID feature bit
Andreas Herrmann (2):
hwmon: (k8temp) Differentiate between AM2 and ASB1
x86, mtrr: Assume SYS_CFG[Tom2ForceMemTypeWB] exists on all future
AMD CPUs
Andrew Morton (1):
drivers/pci/intel-iommu.c: fix build with older gcc's
Andy Gospodarek (1):
bonding: correctly process non-linear skbs
Anton Vorontsov (1):
apm_power: Add missing break statement
Avi Kivity (2):
KVM: VMX: Fix host GDT.LIMIT corruption
KVM: Fix fs/gs reload oops with invalid ldt
Ben Hutchings (7):
ext4: Conditionally define compat ioctl numbers
ext4: Fix compat EXT4_IOC_ADD_GROUP
PCI: MSI: Remove unsafe and unnecessary hardware access
PCI: MSI: Restore read_msi_msg_desc(); add get_cached_msi_msg_desc()
tun: Don't add sysfs attributes to devices without sysfs directories
MIPS: Set io_map_base for several PCI bridges lacking it
sis-agp: Remove SIS 760, handled by amd64-agp
Borislav Petkov (1):
x86, AMD, MCE thresholding: Fix the MCi_MISCj iteration order
Chris Wilson (2):
drm/i915: Prevent double dpms on
drm: Only decouple the old_fb from the crtc is we call mode_set*
Chris Wright (1):
tracing: t_start: reset FTRACE_ITER_HASH in case of seek/pread
Christian Borntraeger (1):
ext4: allow defrag (EXT4_IOC_MOVE_EXT) in 32bit compat mode
Christian Lamparter (3):
p54: fix tx feedback status flag check
p54usb: fix off-by-one on !CONFIG_PM
p54usb: add five more USBIDs
Christof Schmitt (1):
Fix race when removing SCSI devices
Christoph Lameter (1):
mm: page allocator: calculate a better estimate of NR_FREE_PAGES when
memory is low and kswapd is awake
Clemens Ladisch (1):
ALSA: rawmidi: fix oops (use after free) when unloading a driver
module
Cliff Wickman (2):
mm, x86: Saving vmcore with non-lazy freeing of vmas x86, kdump: Change copy_oldmem_page() to use cached addressing
Colin Ian King (1):
ACPI: enable repeated PCIEXP wakeup by clearing PCIEXP_WAKE_STS on
resume
Craig Shelley (1):
USB: CP210x Add new device ID
Curt Wohlgemuth (2):
ext4: Remove extraneous newlines in ext4_msg() calls
ext4: check for a good block group before loading buddy pages
DJ Delorie (1):
USB: cp210x: Add Renesas RX-Stick device ID
Dan Carpenter (9):
KEYS: Return more accurate error codes
USB: ehci-ppc-of: problems in unwind
sysfs: checking for NULL instead of ERR_PTR
irda: off by one
i915: return -EFAULT if copy_to_user fails
i915: return -EFAULT if copy_to_user fails
Staging: vt6655: fix buffer overflow net/llc: make opt unsigned in llc_ui_setsockopt()
gdth: integer overflow in ioctl
Dan Rosenberg (9):
USB: serial/mos*: prevent reading uninitialized stack memory drivers/net/usb/hso.c: prevent reading uninitialized memory drivers/net/cxgb3/cxgb3_main.c: prevent reading uninitialized stack
memory
drivers/net/eql.c: prevent reading uninitialized stack memory drivers/video/sis/sis_main.c: prevent reading uninitialized stack
memory
xfs: prevent reading uninitialized stack memory drivers/video/via/ioctl.c: prevent reading uninitialized stack memory
ALSA: sound/pci/rme9652: prevent reading uninitialized stack memory
ALSA: prevent heap corruption in snd_ctl_new()
Daniel J Blueman (2):
rcu: apply RCU protection to wake_affine() Fix unprotected access to task credentials in waitid()
Daniel Suchy (1):
USB: ftdi_sio: new VID/PIDs for various Papouch devices
Darren Hart (1):
futex: Fix errors in nested key ref-counting
Dave Airlie (1):
drm/radeon: fix PCI ID 5657 to be an RV410
Dave Ludlow (2):
usb: serial: mos7840: Add USB ID to support the B&B Electronics
USOPTL4-2P.
usb: serial: mos7840: Add USB IDs to support more B&B USB/RS485
converters.
David Daney (1):
MIPS: Quit using undefined behavior of ADDU in 64-bit atomic
operations.
David Henningsson (1):
ALSA: hda - Rename iMic to Int Mic on Lenovo NB0763
David Howells (3):
CIFS: Remove __exit mark from cifs_exit_dns_resolver()
KEYS: Fix RCU no-lock warning in keyctl_session_to_parent()
KEYS: Fix bug in keyctl_session_to_parent() if parent has no session
keyring
David Milburn (1):
libsas: fix NCQ mixing with non-NCQ
David S. Miller (6):
irda: Correctly clean up self->ias_obj on irda_bind() failure.
tcp: Combat per-cpu skew in orphan tests.
bridge: Clear INET control block of SKBs passed into ip_fragment().
sparc64: Get rid of indirect p1275 PROM call buffer.
tcp: Fix >4GB writes on 64-bit.
rose: Fix signedness issues wrt. digi count.
Dmitry Monakhov (8):
ext4: check missed return value in ext4_sync_file()
ext4: fix quota accounting in case of fallocate
ext4: Do not zero out uninitialized extents beyond i_size
ext4: clean up inode bitmaps manipulation in ext4_free_inode
ext4: init statistics after journal recovery
ext4: Use bitops to read/modify i_flags in struct ext4_inode_info
ext4: restart ext4_ext_remove_space() after transaction restart
ext4: Fix remaining racy updates of EXT4_I(inode)->i_flags
Dmitry Torokhov (1):
Input: i8042 - fix device removal on unload
Eric Dumazet (5):
gro: fix different skb headrooms
tcp: fix three tcp sysctls tuning
rds: fix a leak of kernel memory
ip: fix truesize mismatch in ip fragmentation
netxen: dont set skb->truesize
Eric Paris (2):
inotify: send IN_UNMOUNT events
inotify: fix inotify oneshot support
Eric Sandeen (4):
ext4: don't return to userspace after freezing the fs with a mutex
held
ext4: stop issuing discards if not supported by device
ext4: don't scan/accumulate more pages than mballoc will allocate
ext4: fix freeze deadlock under IO
Erik J. Staab (1):
ALSA: oxygen: fix analog capture on Claro halo cards
FUJITA Tomonori (1):
bsg: fix incorrect device_status value
Frank Mayhar (1):
ext4: Make fsync sync new parent directories in no-journal mode
Frederic Weisbecker (1):
perf: Initialize callchains roots's childen hits
Gary King (1):
bounce: call flush_dcache_page() after bounce_copy_vec()
Greg Kroah-Hartman (1):
USB: ftdi_sio: add device ids for ScienceScope
Guennadi Liakhovetski (1):
mmc: fix the use of kunmap_atomic() in tmio_mmc.h
Guillem Jover (2):
hwmon: (f75375s) Shift control mode to the correct bit position
hwmon: (f75375s) Do not overwrite values read from registers
H. Peter Anvin (3):
x86-64, compat: Test %rax for the syscall number, not %eax
compat: Make compat_alloc_user_space() incorporate the access_ok() x86, cpu: After uncapping CPUID, re-run CPU feature detection
Haiyang Zhang (2):
staging: hv: Fix missing functions for net_device_ops
staging: hv: Fixed the value of the 64bit-hole inside ring buffer
Hank Janssen (3):
staging: hv: Fixed bounce kmap problem by using correct index
staging: hv: Increased storvsc ringbuffer and max_io_requests
staging: hv: Fixed lockup problem with bounce_buffer scatter list
Herbert Xu (1):
bridge: Clear IPCB before possible entry into IP stack
Jacob Pan (1):
x86: detect scattered cpuid features earlier
Jan Kara (2):
ext4: Show journal_checksum option
char: Mark /dev/zero and /dev/kmem as not capable of writeback
Jan Sembera (1):
binfmt_misc: fix binfmt_misc priority
Jarek Poplawski (1):
gro: Re-fix different skb headrooms
Jason Detring (1):
USB: cp210x: Add B&G H3000 link cable ID
Jean-Christophe PLAGNIOL-VILLARD (1):
USB: atmel_usba_udc: force vbus_pin at -EINVAL when gpio_request
failled
Jeff Moyer (1):
aio: check for multiplication overflow in do_io_submit
Jeremy Fitzhardinge (3):
xen: handle events as edge-triggered
xen: use percpu interrupts for IPIs and VIRQs
tracing/x86: Don't use mcount in pvclock.c
Jerome Marchand (1):
kernel/groups.c: fix integer overflow in groups_search
Jianzhao Wang (1):
net: blackhole route should always be recalculated
Jing Zhang (3):
ext4: fix memory leaks in error path handling of ext4_ext_zeroout()
ext4: Remove unnecessary call to ext4_get_group_desc() in mballoc
ext4: rename ext4_mb_release_desc() to ext4_mb_unload_buddy()
Jiri Olsa (1):
oprofile: Add Support for Intel CPU Family 6 / Model 29
Joel Becker (1):
ocfs2: Don't walk off the end of fast symlinks.
Joerg Roedel (3):
x86/amd-iommu: Set iommu configuration flags in enable-loop x86/amd-iommu: Fix rounding-bug in __unmap_single x86/amd-iommu: Work around S3 BIOS bug
Johannes Berg (2):
wireless extensions: fix kernel heap content leak
wext: fix potential private ioctl memory content leak
John W. Linville (2):
ath5k: check return value of ieee80211_get_tx_rate
hostap_pci: set dev->base_addr during probe
Julia Lawall (1):
drivers/net/wireless/p54/eeprom.c: Return -ENOMEM on memory
allocation failure
KAMEZAWA Hiroyuki (1):
memory hotplug: fix next block calculation in is_removable
KOSAKI Motohiro (1):
tcp: select(writefds) don't hang up when a peer close connection
Kees Cook (1):
net: clear heap allocations for privileged ethtool actions
Kenneth Waters (1):
Input: joydev - fix JSIOCSAXMAP ioctl
Kumar Sanghvi (1):
Phonet: Correct header retrieval after pskb_may_pull
Len Brown (3):
intel_idle: PCI quirk to prevent Lenovo Ideapad s10-3 boot hang
ACPI: EC: add Vista incompatibility DMI entry for Toshiba Satellite
L355
ACPI: delete ZEPTO idle=nomwait DMI quirk
Li Zefan (1):
tracing: Fix a race in function profile
Linus Torvalds (2):
v4l1: fix 32-bit compat microcode loading translation De-pessimize rds_page_copy_user
Luca Tettamanti (1):
atl1: fix resume
Luis R. Rodriguez (2):
ath5k: drop warning on jumbo frames
ath9k_hw: fix parsing of HT40 5 GHz CTLs
Luke Lowrey (1):
USB: ftdi_sio: Added custom PIDs for ChamSys products
Luke Yelavich (1):
ALSA: hda - Add Dell Latitude E6400 model quirk
Maciej Żenczykowski (1):
net: Fix IPv6 PMTU disc. w/ asymmetric routes
Marek Szyprowski (1):
mmc: sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove
Mark Lord (1):
sata_mv: fix broken DSM/TRIM support (v2)
Mathieu Desnoyers (1):
sched: Fix string comparison in /proc/sched_features
Matt Evans (1):
powerpc: Initialise paca->kstack before early_setup_secondary
Mauro Carvalho Chehab (2):
V4L/DVB: cx231xx: Avoid an OOPS when card is unknown (card=0)
USB: option: Add more ZTE modem USB id's
Max Vozeler (2):
staging: usbip: Notify usb core of port status changes
staging: usbip: Process event flags without delay
Maxim Osipov (1):
USB: Fix kernel oops with g_ether and Windows
Mel Gorman (2):
mm: page allocator: drain per-cpu lists after direct reclaim
allocation fails
mm: page allocator: update free page counters after pages are placed
on the free list
Michael Cree (1):
alpha: Fix printk format errors
Michael Neuling (1):
powerpc: Don't use kernel stack with translation off
Michael Reed (1):
sd name space exhaustion causes system hang
Mike Christie (1):
Fix regressions in scsi_internal_device_block
Mike Galbraith (1):
sched: Fix select_idle_sibling()
Miklos Szeredi (1):
fuse: flush background queue on connection close
Ming Lei (1):
usb: musb: gadget: fix kernel panic if using out ep with FIFO_TXRX
style
Nagendra Tomar (1):
net: Fix the condition passed to sk_wait_event()
Nicolas Ferre (1):
AT91: change dma resource index
Nicolas Kaiser (1):
pipe: fix failure to return error code on ->confirm()
Nikanth Karthikesan (1):
ext4: Prevent creation of files larger than RLIMIT_FSIZE using
fallocate
Oleg Nesterov (6):
sched: Kill the broken and deadlockable
cpuset_lock/cpuset_cpus_allowed_locked code
sched: move_task_off_dead_cpu(): Take rq->lock around
select_fallback_rq()
sched: move_task_off_dead_cpu(): Remove retry logic
sched: sched_exec(): Remove the select_fallback_rq() logic
sched: _cpu_down(): Don't play with current->cpus_allowed
sched: Make select_fallback_rq() cpuset friendly
Patrick Simmons (1):
oprofile: Add Support for Intel CPU Family 6 / Model 22 (Intel
Celeron 540)
Paul E. McKenney (1):
pid: make setpgid() system call use RCU read-side critical section
Paul Fertser (1):
b44: fix carrier detection on bind
Paul Fox (1):
x86, olpc: Don't retry EC commands forever
Paul Mackerras (1):
powerpc/perf: Fix sampling enable for PPC970
Peter Oberparleiter (2):
gcov: fix null-pointer dereference for certain module types
dasd: use correct label location for diag fba disks
Peter Zijlstra (6):
x86, tsc: Fix a preemption leak in restore_sched_clock_state()
sched: Fix TASK_WAKING vs fork deadlock
sched: Optimize task_rq_lock()
sched: Fix nr_uninterruptible count
sched: Fix rq->clock synchronization when migrating tasks
sched: Pre-compute cpumask_weight(sched_domain_span(sd))
Petr Tesarik (1):
Optimize ticket spinlocks in fsys_rt_sigprocmask
Philippe Corbes (1):
USB: cdc-acm: Add pseudo modem without AT command capabilities
Przemo Firszt (1):
USB: Expose vendor-specific ACM channel on Nokia 5230
Rainer Keller (1):
USB: add PID for FTDI based OpenDCC hardware
Rich Mattes (1):
USB: ftdi_sio: Add PID for accesio products
Robert Richter (3):
oprofile: fix crash when accessing freed task structs oprofile, x86: fix init_sysfs error handling oprofile, x86: fix init_sysfs() function stub
Robin Holt (1):
sgi-xp: incoming XPC channel messages can come in after the channel's
partition structures have been torn down
Roland McGrath (4):
x86-64, compat: Retruncate rax after ia32 syscall entry tracing
setup_arg_pages: diagnose excessive argument size
execve: improve interactivity with large arguments
execve: make responsive to SIGKILL with large arguments
Ryan Kuester (1):
mptsas: fix hangs caused by ATA pass-through
Salman Qazi (1):
hrtimer: Preserve timer state in remove_hrtimer()
Sergei Shtylyov (2):
usb: musb: gadget: restart request on clearing endpoint halt
usb: musb: blackfin: call gpio_free() on error path in
musb_platform_init()
Simon Guinot (1):
dmaengine: fix interrupt clearing for mv_xor
Stanislaw Gruszka (3):
sched: Fix user time incorrectly accounted as system time on 32-bit
skge: add quirk to limit DMA
r8169: allocate with GFP_KERNEL flag when able to sleep
Stefan Bader (1):
mm: Move vma_stack_continue into mm.h
Steve Wise (1):
RDMA/cxgb3: Turn off RX coalescing for iWARP connections
Steven Rostedt (3):
tracing: Do not allow llseek to set_ftrace_filter tracing/x86: Don't use mcount in kvmclock.c
ring-buffer: Fix typo of time extends per page
Sunil Mushran (1):
ocfs2: Fix incorrect checksum validation error
Suresh Siddha (3):
x86, tsc, sched: Recompute cyc2ns_offset's during resume from sleep
states
sched: Fix select_idle_sibling() logic in select_task_rq_fair() x86, intr-remap: Set redirection hint in the IRTE
Takashi Iwai (3):
ALSA: seq/oss - Fix double-free at error path of snd_seq_oss_open()
ALSA: hda - Handle missing NID 0x1b on ALC259 codec
ALSA: hda - Handle pin NID 0x1a on ALC259/269
Tejun Heo (3):
libata: skip EH autopsy and recovery during suspend
percpu: fix pcpu_last_unit_cpu
ubd: fix incorrect sector handling during request restart
Tetsuo Handa (1):
UNIX: Do not loop forever at unix_autobind().
Theodore Ts'o (2):
ext4: Avoid crashing on NULL ptr dereference on a filesystem error
ext4: Clear the EXT4_EOFBLOCKS_FL flag only when warranted
Thomas Gleixner (2):
x86, hpet: Fix bogus error check in hpet_assign_irq() x86, irq: Plug memory leak in sparse irq
Toby Gray (2):
USB: cdc-acm: Adding second ACM channel support for various Nokia and
one Samsung phones
USB: cdc-acm: Fixing crash when ACM probing interfaces with no
endpoint descriptors.
Tom Marshall (1):
tcp: Fix race in tcp_poll
Tony Luck (2):
fix siglock
guard page for stacks that grow upwards
Trond Myklebust (2):
NFS: Fix a typo in nfs_sockaddr_match_ipaddr6
SUNRPC: Fix race corrupting rpc upcall
Ulrich Weber (1):
xfrm4: strip ECN bits from tos field
Vasiliy Kulikov (1):
pcmcia: synclink_cs: fix information leak to userland
Vlad Yasevich (1):
sctp: Do not reset the packet during sctp_packet_config().
Wei Yongjun (1):
sctp: fix append error cause to ERROR chunk correctly
Xiao Guangrong (2):
KVM: MMU: fix direct sp's access corrupted
KVM: MMU: fix conflict access permissions in direct sp
Yegor Yefremov (1):
i2c-pca: Fix waitforcompletion() return value
Yusuke Goda (1):
tmio_mmc: don't clear unhandled pending interrupts
Zachary Amsden (2):
KVM: x86: Fix SVM VMCB reset
KVM: x86: Move TSC reset out of vmcb_init
Zhang Rui (1):
ACPI: Disable Windows Vista compatibility for Toshiba P305D
arch/alpha/kernel/err_marvel.c | 6 +- arch/arm/kernel/entry-common.S | 2 + arch/arm/mach-at91/at91sam9g45_devices.c | 2 +- arch/ia64/include/asm/compat.h | 2 +- arch/ia64/kernel/fsys.S | 30 ++- arch/ia64/kernel/msi_ia64.c | 2 +- arch/ia64/sn/kernel/msi_sn.c | 2 +- arch/mips/include/asm/atomic.h | 24 +- arch/mips/include/asm/compat.h | 2 +- arch/mips/mti-malta/malta-pci.c | 2 + arch/mips/nxp/pnx8550/common/pci.c | 1 + arch/mips/nxp/pnx8550/common/setup.c | 2 +- arch/mips/pci/ops-pmcmsp.c | 1 + arch/mips/pci/pci-yosemite.c | 1 + arch/parisc/include/asm/compat.h | 2 +- arch/powerpc/include/asm/compat.h | 2 +- arch/powerpc/kernel/head_64.S | 18 +- arch/powerpc/kernel/ppc970-pmu.c | 2 + arch/s390/include/asm/compat.h | 2 +- arch/sparc/include/asm/compat.h | 2 +- arch/sparc/include/asm/oplib_64.h | 27 +-- arch/sparc/prom/cif.S | 16 +- arch/sparc/prom/console_64.c | 48 +++- arch/sparc/prom/devops_64.c | 36 +++- arch/sparc/prom/misc_64.c | 314 +++++++++++++++++++-------- arch/sparc/prom/p1275.c | 102 +--------- arch/sparc/prom/tree_64.c | 210 +++++++++++++----- arch/um/drivers/ubd_kern.c | 9 +- arch/x86/ia32/ia32entry.S | 22 ++- arch/x86/include/asm/amd_iommu_proto.h | 6 + arch/x86/include/asm/amd_iommu_types.h | 12 + arch/x86/include/asm/compat.h | 2 +- arch/x86/include/asm/cpufeature.h | 2 +- arch/x86/include/asm/io.h | 1 + arch/x86/include/asm/kvm_host.h | 24 -- arch/x86/include/asm/smp.h | 9 +- arch/x86/include/asm/tsc.h | 2 + arch/x86/kernel/Makefile | 2 + arch/x86/kernel/amd_iommu.c | 4 +- arch/x86/kernel/amd_iommu_init.c | 67 ++++-- arch/x86/kernel/apic/io_apic.c | 15 +- arch/x86/kernel/cpu/common.c | 4 +- arch/x86/kernel/cpu/cpu.h | 1 + arch/x86/kernel/cpu/intel.c | 1 + arch/x86/kernel/cpu/mcheck/mce_amd.c | 9 +- arch/x86/kernel/cpu/mtrr/cleanup.c | 2 +- arch/x86/kernel/crash_dump_64.c | 3 +- arch/x86/kernel/hpet.c | 2 +- arch/x86/kernel/olpc.c | 5 +- arch/x86/kernel/reboot.c | 2 +- arch/x86/kernel/smp.c | 15 +- arch/x86/kernel/tsc.c | 38 ++++ arch/x86/kvm/paging_tmpl.h | 30 +++- arch/x86/kvm/svm.c | 17 +- arch/x86/kvm/vmx.c | 28 +-- arch/x86/kvm/x86.c | 2 +- arch/x86/oprofile/nmi_int.c | 27 ++- arch/x86/power/cpu.c | 2 + arch/x86/xen/enlighten.c | 2 +- arch/x86/xen/smp.c | 6 +- block/bsg.c | 2 +- drivers/acpi/acpica/aclocal.h | 1 + drivers/acpi/blacklist.c | 16 ++ drivers/acpi/processor_core.c | 6 - drivers/ata/libata-core.c | 14 +- drivers/ata/libata-eh.c | 4 + drivers/ata/sata_mv.c | 44 +++- drivers/bluetooth/hci_ldisc.c | 7 + drivers/char/agp/sis-agp.c | 8 - drivers/char/mem.c | 3 +- drivers/char/pcmcia/synclink_cs.c | 2 + drivers/dma/mv_xor.c | 2 +- drivers/gpu/drm/drm_crtc_helper.c | 4 +- drivers/gpu/drm/i915/i915_dma.c | 12 +- drivers/gpu/drm/i915/i915_gem.c | 1 + drivers/gpu/drm/i915/intel_display.c | 5 +- drivers/hwmon/f75375s.c | 6 +- drivers/hwmon/k8temp.c | 35 +++- drivers/i2c/busses/i2c-pca-isa.c | 12 +- drivers/i2c/busses/i2c-pca-platform.c | 11 +- drivers/infiniband/hw/cxgb3/iwch_cm.c | 6 +- drivers/input/joydev.c | 3 + drivers/input/serio/i8042.c | 2 +- drivers/media/video/cx231xx/cx231xx-cards.c | 14 +- drivers/media/video/v4l2-compat-ioctl32.c | 32 ++- drivers/message/fusion/mptscsih.c | 2 + drivers/misc/sgi-xp/xpc_uv.c | 17 ++ drivers/mmc/host/sdhci-s3c.c | 6 +- drivers/mmc/host/tmio_mmc.c | 7 +- drivers/mmc/host/tmio_mmc.h | 13 +- drivers/net/atlx/atl1.c | 5 +- drivers/net/b44.c | 4 +- drivers/net/bonding/bond_3ad.c | 3 + drivers/net/bonding/bond_alb.c | 3 + drivers/net/cxgb3/cxgb3_main.c | 2 + drivers/net/eql.c | 2 + drivers/net/netxen/netxen_nic_init.c | 3 - drivers/net/r8169.c | 12 +- drivers/net/skge.c | 18 ++- drivers/net/tun.c | 3 +- drivers/net/usb/hso.c | 2 + drivers/net/wireless/ath/ath5k/base.c | 11 +- drivers/net/wireless/ath/ath9k/eeprom.h | 2 +- drivers/net/wireless/ath/regd.h | 1 - drivers/net/wireless/hostap/hostap_pci.c | 1 + drivers/net/wireless/p54/eeprom.c | 4 +- drivers/net/wireless/p54/p54usb.c | 15 ++- drivers/net/wireless/p54/txrx.c | 2 +- drivers/oprofile/buffer_sync.c | 27 ++- drivers/oprofile/cpu_buffer.c | 2 - drivers/pci/intel-iommu.c | 90 ++++---- drivers/pci/msi.c | 27 +++- drivers/pci/quirks.c | 20 ++ drivers/power/apm_power.c | 1 + drivers/scsi/gdth.c | 8 + drivers/scsi/libsas/sas_ata.c | 1 + drivers/scsi/scsi_lib.c | 3 +- drivers/scsi/scsi_sysfs.c | 3 +- drivers/scsi/sd.c | 15 +- drivers/staging/hv/RingBuffer.c | 3 +- drivers/staging/hv/StorVscApi.h | 4 +- drivers/staging/hv/netvsc_drv.c | 3 + drivers/staging/hv/storvsc_drv.c | 9 +- drivers/staging/usbip/usbip_event.c | 16 +- drivers/staging/usbip/vhci_hcd.c | 2 + drivers/staging/vt6655/wpactl.c | 11 +- drivers/usb/class/cdc-acm.c | 24 ++- drivers/usb/core/file.c | 35 ++-- drivers/usb/core/hub.c | 9 +- drivers/usb/core/message.c | 15 +- drivers/usb/gadget/atmel_usba_udc.c | 3 + drivers/usb/gadget/rndis.c | 10 +- drivers/usb/host/ehci-ppc-of.c | 12 +- drivers/usb/musb/blackfin.c | 4 +- drivers/usb/musb/musb_gadget.c | 22 ++- drivers/usb/musb/musb_gadget.h | 2 + drivers/usb/musb/musb_gadget_ep0.c | 9 + drivers/usb/serial/cp210x.c | 12 +- drivers/usb/serial/ftdi_sio.c | 43 ++++- drivers/usb/serial/ftdi_sio_ids.h | 51 +++++- drivers/usb/serial/mos7720.c | 3 + drivers/usb/serial/mos7840.c | 35 ++- drivers/usb/serial/opticon.c | 6 +- drivers/usb/serial/option.c | 23 ++- drivers/video/sis/sis_main.c | 3 + drivers/video/via/ioctl.c | 2 + drivers/xen/events.c | 21 ++- fs/aio.c | 3 + fs/binfmt_misc.c | 2 +- fs/char_dev.c | 4 +- fs/cifs/dns_resolve.c | 2 +- fs/cifs/dns_resolve.h | 2 +- fs/exec.c | 14 ++ fs/ext4/dir.c | 4 +- fs/ext4/ext4.h | 129 ++++++++++-- fs/ext4/ext4_jbd2.h | 8 +- fs/ext4/extents.c | 140 +++++++++---- fs/ext4/file.c | 2 +- fs/ext4/fsync.c | 33 +++- fs/ext4/ialloc.c | 89 ++++---- fs/ext4/inode.c | 88 +++++--- fs/ext4/ioctl.c | 25 ++- fs/ext4/mballoc.c | 108 +++++++--- fs/ext4/migrate.c | 2 +- fs/ext4/move_extent.c | 4 +- fs/ext4/namei.c | 12 +- fs/ext4/super.c | 65 +++--- fs/ext4/xattr.c | 4 +- fs/fuse/dev.c | 16 +- fs/nfs/client.c | 2 +- fs/notify/inotify/inotify_fsnotify.c | 3 + fs/notify/inotify/inotify_user.c | 7 +- fs/ocfs2/inode.c | 6 +- fs/ocfs2/symlink.c | 2 +- fs/partitions/ibm.c | 13 +- fs/pipe.c | 2 +- fs/proc/task_mmu.c | 3 +- fs/sysfs/file.c | 2 +- fs/xfs/linux-2.6/xfs_ioctl.c | 2 + include/drm/drm_pciids.h | 2 +- include/linux/compat.h | 3 + include/linux/cpuset.h | 16 +- include/linux/libata.h | 1 + include/linux/mm.h | 14 +- include/linux/mmzone.h | 13 + include/linux/msi.h | 2 + include/linux/pci_ids.h | 3 + include/linux/sched.h | 5 +- include/linux/socket.h | 2 +- include/linux/vmstat.h | 22 ++ include/net/tcp.h | 36 +++- kernel/compat.c | 21 ++ kernel/cpu.c | 18 +- kernel/cpuset.c | 67 ++++-- kernel/exit.c | 5 +- kernel/futex.c | 31 ++-- kernel/gcov/fs.c | 244 +++++++++++++++------ kernel/groups.c | 5 +- kernel/hrtimer.c | 13 +- kernel/sched.c | 180 +++++++--------- kernel/sched_fair.c | 106 +++++---- kernel/sched_idletask.c | 3 +- kernel/sched_rt.c | 5 +- kernel/sys.c | 2 + kernel/trace/ftrace.c | 19 ++- kernel/trace/ring_buffer.c | 2 +- mm/bounce.c | 2 +- mm/memory.c | 15 +- mm/memory_hotplug.c | 16 +- mm/mlock.c | 6 - mm/mmap.c | 3 - mm/mmzone.c | 21 ++ mm/page_alloc.c | 33 ++- mm/percpu.c | 2 +- mm/vmalloc.c | 9 + mm/vmstat.c | 15 ++- net/bridge/br_netfilter.c | 9 +- net/core/ethtool.c | 4 +- net/core/iovec.c | 5 +- net/core/skbuff.c | 6 +- net/core/stream.c | 8 +- net/ipv4/ip_output.c | 19 +- net/ipv4/route.c | 7 +- net/ipv4/tcp.c | 41 ++-- net/ipv4/tcp_input.c | 2 + net/ipv4/tcp_timer.c | 8 +- net/ipv4/xfrm4_policy.c | 2 +- net/ipv6/ip6_output.c | 18 +- net/ipv6/route.c | 28 ++- net/irda/af_irda.c | 4 +- net/irda/irlan/irlan_common.c | 2 +- net/llc/af_llc.c | 3 +- net/phonet/pep.c | 3 +- net/rds/page.c | 27 +-- net/rds/recv.c | 2 +- net/rose/af_rose.c | 4 +- net/sctp/output.c | 1 - net/sctp/sm_make_chunk.c | 4 +- net/sunrpc/auth_gss/auth_gss.c | 9 +- net/sunrpc/rpc_pipe.c | 6 +- net/unix/af_unix.c | 15 +- net/wireless/wext-compat.c | 3 + net/wireless/wext-core.c | 16 ++ net/wireless/wext-priv.c | 2 +- security/keys/keyctl.c | 6 +- security/keys/process_keys.c | 6 +- sound/core/control.c | 5 + sound/core/rawmidi.c | 4 +- sound/core/seq/oss/seq_oss_init.c | 9 +- sound/pci/hda/patch_analog.c | 1 + sound/pci/hda/patch_realtek.c | 8 +- sound/pci/oxygen/oxygen.c | 4 + sound/pci/rme9652/hdsp.c | 1 + sound/pci/rme9652/hdspm.c | 1 + tools/perf/util/callchain.h | 1 + 255 files changed, 2861 insertions(+), 1415 deletions(-)
Signature · 1 line
1.7.3.3
PATCH 1/260 sctp: fix append error cause to ERROR chunk correctly
From: Wei Yongjun <[email protected]>
commit 2e3219b5c8a2e44e0b83ae6e04f52f20a82ac0f2 upstream.
commit 5fa782c2f5ef6c2e4f04d3e228412c9b4a4c8809
sctp: Fix skb_over_panic resulting from multiple invalid \
parameter errors (CVE-2010-1173) (v4)
cause 'error cause' never be add the the ERROR chunk due to some typo when check valid length in sctp_init_cause_fixed().
--- net/sctp/sm_make_chunk.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/sctp/sm_make_chunk.c +2 -2
@@ -141,7 +141,7 @@ int sctp_init_cause_fixed(struct sctp_chunk *chunk, __be16 cause_code, len =sizeof (sctp_errhdr_t) + paylen; err.length =htons (len); -if (skb_tailroom (chunk->skb) > len) +if (skb_tailroom (chunk->skb) < len)return -ENOSPC ; chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk, sizeof(sctp_errhdr_t),
@@ -1421,7 +1421,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)void *sctp_addto_chunk_fixed (struct sctp_chunk *chunk,int len,const void *data) { -if (skb_tailroom (chunk->skb) > len) +if (skb_tailroom (chunk->skb) >= len)return sctp_addto_chunk (chunk, len, data);else return NULL ;
Signature · 1 line
1.7.3.3
PATCH 2/260 KEYS: Return more accurate error codes
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
commit 4d09ec0f705cf88a12add029c058b53f288cfaa2 upstream.
We were using the wrong variable here so the error codes weren't being returned properly. The original code returns -ENOKEY.
--- security/keys/process_keys.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
security/keys/process_keys.c +3 -3
@@ -508,7 +508,7 @@ try_again: ret =install_thread_keyring ();if (ret <0 ) { - key =ERR_PTR (ret); + key_ref =ERR_PTR (ret); goto error; } goto reget_creds;
@@ -526,7 +526,7 @@ try_again: ret =install_process_keyring ();if (ret <0 ) { - key =ERR_PTR (ret); + key_ref =ERR_PTR (ret); goto error; } goto reget_creds;
@@ -585,7 +585,7 @@ try_again:case KEY_SPEC_GROUP_KEYRING :/* group keyrings are not yet supported */ - key =ERR_PTR (-EINVAL ); + key_ref =ERR_PTR (-EINVAL ); goto error;case KEY_SPEC_REQKEY_AUTH_KEY :
Signature · 1 line
1.7.3.3
PATCH 3/260 ath5k: drop warning on jumbo frames
In reply to Paul GortmakerFrom: Luis R. Rodriguez <[email protected]>
commit 9637e516d16a58b13f6098cfe899e22963132be3 upstream.
Jumbo frames are not supported, and if they are seen it is likely a bogus frame so just silently discard them instead of warning on them all time. Also, instead of dropping them immediately though move the check *after* we check for all sort of frame errors. This should enable us to discard these frames if the hardware picks other bogus items first. Lets see if we still get those jumbo counters increasing still with this.
Jumbo frames would happen if we tell hardware we can support a small 802.11 chunks of DMA'd frame, hardware would split RX'd frames into parts and we'd have to reconstruct them in software. This is done with USB due to the bulk size but with ath5k we already provide a good limit to hardware and this should not be happening.
This is reported quite often and if it fills the logs then this needs to be addressed and to avoid spurious reports.
--- drivers/net/wireless/ath/ath5k/base.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +2 -5
@@ -1871,11 +1871,6 @@ ath5k_tasklet_rx(unsigned long data)return ; } -if (unlikely (rs.rs_more)) { -ATH5K_WARN (sc,"unsupported jumbo\n" ); - goto next; - } -if (unlikely (rs.rs_status)) {if (rs.rs_status &AR5K_RXERR_PHY ) goto next;
@@ -1905,6 +1900,8 @@ ath5k_tasklet_rx(unsigned long data) sc->opmode != NL80211_IFTYPE_MONITOR) goto next; } +if (unlikely (rs.rs_more)) + goto next; accept: next_skb =ath5k_rx_skb_alloc (sc, &next_skb_addr);
Signature · 1 line
1.7.3.3
PATCH 4/260 ext4: check missed return value in ext4_sync_file()
In reply to Paul GortmakerFrom: Dmitry Monakhov <[email protected]>
commit 0671e704658b9f26f85e78d51176daa861f955c7 upstream.
--- fs/ext4/fsync.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ext4/fsync.c +1 -1
@@ -101,7 +101,7 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync) (journal->j_fs_dev != journal->j_dev) && (journal->j_flags & JBD2_BARRIER))blkdev_issue_flush (inode->i_sb->s_bdev,NULL ); -jbd2_log_wait_commit (journal, commit_tid); + ret =jbd2_log_wait_commit (journal, commit_tid); }else if (journal->j_flags &JBD2_BARRIER )blkdev_issue_flush (inode->i_sb->s_bdev,NULL );return ret;
Signature · 1 line
1.7.3.3
PATCH 5/260 ext4: fix memory leaks in error path handling of ext4_ext_zeroout()
In reply to Paul GortmakerFrom: Jing Zhang <[email protected]>
commit b720303df7352d4a7a1f61e467e0a124913c0d41 upstream.
When EIO occurs after bio is submitted, there is no memory free operation for bio, which results in memory leakage. And there is also no check against bio_alloc() for bio.
--- fs/ext4/extents.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
fs/ext4/extents.c +8 -7
@@ -2544,7 +2544,7 @@ static void bi_complete(struct bio *bio, int error)/* FIXME!! we need to try to merge to left or right after zero-out */ static int ext4_ext_zeroout (struct inode *inode,struct ext4_extent *ex) { -int ret = -EIO ; +int ret;struct bio *bio;int blkbits, blocksize;sector_t ee_pblock;
@@ -2568,6 +2568,9 @@ static int ext4_ext_zeroout(struct inode *inode, struct ext4_extent *ex) len = ee_len; bio =bio_alloc (GFP_NOIO , len); +if (!bio) +return -ENOMEM ; + bio->bi_sector = ee_pblock; bio->bi_bdev = inode->i_sb->s_bdev;
@@ -2595,17 +2598,15 @@ static int ext4_ext_zeroout(struct inode *inode, struct ext4_extent *ex)submit_bio (WRITE , bio);wait_for_completion (&event); -if (test_bit (BIO_UPTODATE , &bio->bi_flags)) - ret =0 ; -else { - ret = -EIO ; -break ; +if (!test_bit (BIO_UPTODATE , &bio->bi_flags)) { +bio_put (bio); +return -EIO ; }bio_put (bio); ee_len -= done; ee_pblock += done << (blkbits -9 ); } -return ret; +return 0 ; }#define EXT4_EXT_ZERO_LEN 7
Signature · 1 line
1.7.3.3
PATCH 6/260 ext4: Remove unnecessary call to ext4_get_group_desc() in mballoc
In reply to Paul GortmakerFrom: Jing Zhang <[email protected]>
commit 62e823a2cba18509ee826d775270e8ef9071b5bc upstream.
--- fs/ext4/mballoc.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
fs/ext4/mballoc.c +0 -2
@@ -2025,7 +2025,6 @@ repeat:for (i =0 ; i < ngroups; group++, i++) {struct ext4_group_info *grp; -struct ext4_group_desc *desc;if (group == ngroups) group =0 ;
@@ -2048,7 +2047,6 @@ repeat: } ac->ac_groups_scanned++; - desc =ext4_get_group_desc (sb, group,NULL );if (cr ==0 )ext4_mb_simple_scan_group (ac, &e4b); else if (cr == 1 &&
Signature · 1 line
1.7.3.3
PATCH 7/260 ext4: rename ext4_mb_release_desc() to ext4_mb_unload_buddy()
In reply to Paul GortmakerFrom: Jing Zhang <[email protected]>
commit e39e07fdfd98be8650385f12a7b81d6adc547510 upstream.
This function cleans up after ext4_mb_load_buddy(), so the renaming makes the code clearer.
--- fs/ext4/mballoc.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
fs/ext4/mballoc.c +12 -12
@@ -1150,7 +1150,7 @@ err:return ret; } -static void ext4_mb_release_desc (struct ext4_buddy *e4b) +static void ext4_mb_unload_buddy (struct ext4_buddy *e4b) {if (e4b->bd_bitmap_page)page_cache_release (e4b->bd_bitmap_page);
@@ -1617,7 +1617,7 @@ int ext4_mb_try_best_found(struct ext4_allocation_context *ac, }ext4_unlock_group (ac->ac_sb, group); -ext4_mb_release_desc (e4b); +ext4_mb_unload_buddy (e4b);return 0 ; }
@@ -1672,7 +1672,7 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac,ext4_mb_use_best_found (ac, e4b); }ext4_unlock_group (ac->ac_sb, group); -ext4_mb_release_desc (e4b); +ext4_mb_unload_buddy (e4b);return 0 ; }
@@ -2042,7 +2042,7 @@ repeat:if (!ext4_mb_good_group (ac, group, cr)) {/* someone did allocation from this group */ ext4_unlock_group (sb, group); -ext4_mb_release_desc (&e4b); +ext4_mb_unload_buddy (&e4b);continue ; }
@@ -2056,7 +2056,7 @@ repeat:ext4_mb_complex_scan_group (ac, &e4b);ext4_unlock_group (sb, group); -ext4_mb_release_desc (&e4b); +ext4_mb_unload_buddy (&e4b);if (ac->ac_status !=AC_STATUS_CONTINUE )break ;
@@ -2146,7 +2146,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)ext4_lock_group (sb, group);memcpy (&sg,ext4_get_group_info (sb, group), i);ext4_unlock_group (sb, group); -ext4_mb_release_desc (&e4b); +ext4_mb_unload_buddy (&e4b);seq_printf (seq,"#%-5u: %-5u %-5u %-5u [" , group, sg.info.bb_free, sg.info.bb_fragments, sg.info.bb_first_free);
@@ -2566,7 +2566,7 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) }ext4_unlock_group (sb, entry->group);kmem_cache_free (ext4_free_ext_cachep, entry); -ext4_mb_release_desc (&e4b); +ext4_mb_unload_buddy (&e4b); }mb_debug (1 ,"freed %u blocks in %u structures\n" , count, count2);
@@ -3695,7 +3695,7 @@ out:ext4_unlock_group (sb, group);if (ac)kmem_cache_free (ext4_ac_cachep, ac); -ext4_mb_release_desc (&e4b); +ext4_mb_unload_buddy (&e4b);put_bh (bitmap_bh);return free; }
@@ -3799,7 +3799,7 @@ repeat:if (bitmap_bh ==NULL ) {ext4_error (sb,"Error reading block bitmap for %u" , group); -ext4_mb_release_desc (&e4b); +ext4_mb_unload_buddy (&e4b);continue ; }
@@ -3808,7 +3808,7 @@ repeat:ext4_mb_release_inode_pa (&e4b, bitmap_bh, pa, ac);ext4_unlock_group (sb, group); -ext4_mb_release_desc (&e4b); +ext4_mb_unload_buddy (&e4b);put_bh (bitmap_bh);list_del (&pa->u.pa_tmp_list);
@@ -4072,7 +4072,7 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb,ext4_mb_release_group_pa (&e4b, pa, ac);ext4_unlock_group (sb, group); -ext4_mb_release_desc (&e4b); +ext4_mb_unload_buddy (&e4b);list_del (&pa->u.pa_tmp_list);call_rcu (&(pa)->u.pa_rcu, ext4_mb_pa_callback); }
@@ -4608,7 +4608,7 @@ do_more:atomic_add (count, &sbi->s_flex_groups[flex_group].free_blocks); } -ext4_mb_release_desc (&e4b); +ext4_mb_unload_buddy (&e4b); freed += count;
Signature · 1 line
1.7.3.3
PATCH 8/260 ext4: allow defrag (EXT4_IOC_MOVE_EXT) in 32bit compat mode
In reply to Paul GortmakerFrom: Christian Borntraeger <[email protected]>
commit b684b2ee9409f2890a8b3aea98525bbe5f84e276 upstream.
I have an x86_64 kernel with i386 userspace. e4defrag fails on the EXT4_IOC_MOVE_EXT ioctl because it is not wired up for the compat case. It seems that struct move_extent is compat save, only types with fixed widths are used:
{
__u32 reserved; /* should be zero */
__u32 donor_fd; /* donor file descriptor */
__u64 orig_start; /* logical start offset in block for orig */
__u64 donor_start; /* logical start offset in block for donor */
__u64 len; /* block length to be moved */
__u64 moved_len; /* moved block length */};
Lets just wire up EXT4_IOC_MOVE_EXT for the compat case.
--- fs/ext4/ioctl.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/ext4/ioctl.c +2 -0
@@ -375,6 +375,8 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)break ;case EXT4_IOC_GROUP_ADD :break ; +case EXT4_IOC_MOVE_EXT : +break ;default :return -ENOIOCTLCMD ; }
Signature · 1 line
1.7.3.3
PATCH 9/260 ext4: fix quota accounting in case of fallocate
In reply to Paul GortmakerFrom: Dmitry Monakhov <[email protected]>
commit 35121c9860316d7799cea0fbc359a9186e7c2747 upstream.
allocated_meta_data is already included in 'used' variable.
--- fs/ext4/inode.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
fs/ext4/inode.c +2 -1
@@ -1126,7 +1126,8 @@ void ext4_da_update_reserve_space(struct inode *inode,*/ if (allocated_meta_blocks)dquot_claim_block (inode, allocated_meta_blocks); -dquot_release_reservation_block (inode, mdb_free + used); +dquot_release_reservation_block (inode, mdb_free + used - + allocated_meta_blocks); }/*
Signature · 1 line
1.7.3.3
PATCH 10/260 ext4: don't return to userspace after freezing the fs with a mutex held
In reply to Paul GortmakerFrom: Eric Sandeen <[email protected]>
commit 6b0310fbf087ad6e9e3b8392adca97cd77184084 upstream.
ext4_freeze() used jbd2_journal_lock_updates() which takes the j_barrier mutex, and then returns to userspace. The kernel does not like this:
================================================
[ BUG: lock held when returning to user space! ]
------------------------------------------------
lvcreate/1075 is leaving the kernel with locks still held! 1 lock held by lvcreate/1075:
#0: (&journal->j_barrier){+.+...}, at: [<ffffffff811c6214>]jbd2_journal_lock_updates+0xe1/0xf0
Use vfs_check_frozen() added to ext4_journal_start_sb() and ext4_force_commit() instead.
Addresses-Red-Hat-Bugzilla: #568503
--- fs/ext4/super.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
fs/ext4/super.c +10 -10
@@ -241,6 +241,7 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks)if (sb->s_flags &MS_RDONLY )return ERR_PTR (-EROFS ); +vfs_check_frozen (sb,SB_FREEZE_WRITE );/* Special case here: if the journal has aborted behind our * backs (eg. EIO in the commit thread), then we still need to * take the FS itself readonly cleanly. */
@@ -3485,8 +3486,10 @@ int ext4_force_commit(struct super_block *sb)return 0 ; journal =EXT4_SB (sb)->s_journal; -if (journal) +if (journal) { +vfs_check_frozen (sb,SB_FREEZE_WRITE ); ret =ext4_journal_force_commit (journal); + }return ret; }
@@ -3535,18 +3538,16 @@ static int ext4_freeze(struct super_block *sb)* the journal. */ error =jbd2_journal_flush (journal); -if (error <0 ) { - out: -jbd2_journal_unlock_updates (journal); -return error; - } +if (error <0 ) + goto out;/* Journal blocked and flushed, clear needs_recovery flag. */ EXT4_CLEAR_INCOMPAT_FEATURE (sb,EXT4_FEATURE_INCOMPAT_RECOVER ); error =ext4_commit_super (sb,1 ); -if (error) - goto out; -return 0 ; +out: +/* we rely on s_frozen to stop further updates */ +jbd2_journal_unlock_updates (EXT4_SB (sb)->s_journal); +return error; }/*
@@ -3563,7 +3564,6 @@ static int ext4_unfreeze(struct super_block *sb)EXT4_SET_INCOMPAT_FEATURE (sb,EXT4_FEATURE_INCOMPAT_RECOVER );ext4_commit_super (sb,1 );unlock_super (sb); -jbd2_journal_unlock_updates (EXT4_SB (sb)->s_journal);return 0 ; }
Signature · 1 line
1.7.3.3
PATCH 11/260 ext4: stop issuing discards if not supported by device
In reply to Paul GortmakerFrom: Eric Sandeen <[email protected]>
commit a30eec2a8650a77f754e84b2e15f062fe652baa7 upstream.
Turn off issuance of discard requests if the device does not support it - similar to the action we take for barriers. This will save a little computation time if a non-discardable device is mounted with -o discard, and also makes it obvious that it's not doing what was asked at mount time ...
--- fs/ext4/mballoc.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
fs/ext4/mballoc.c +7 -1
@@ -2534,6 +2534,7 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn) entry->count, entry->group, entry);if (test_opt (sb,DISCARD )) { +int ret;ext4_fsblk_t discard_block; discard_block = entry->start_blk +
@@ -2541,7 +2542,12 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)trace_ext4_discard_blocks (sb, (unsigned long long )discard_block, entry->count); -sb_issue_discard (sb, discard_block, entry->count); + ret =sb_issue_discard (sb, discard_block, entry->count); +if (ret ==EOPNOTSUPP ) { +ext4_warning (sb, +"discard not supported, disabling" ); +clear_opt (EXT4_SB (sb)->s_mount_opt,DISCARD ); + } } err =ext4_mb_load_buddy (sb, entry->group, &e4b);
Signature · 1 line
1.7.3.3
PATCH 12/260 ext4: don't scan/accumulate more pages than mballoc will allocate
In reply to Paul GortmakerFrom: Eric Sandeen <[email protected]>
commit c445e3e0a5c2804524dec6e55f66d63f6bc5bc3e upstream.
There was a bug reported on RHEL5 that a 10G dd on a 12G box had a very, very slow sync after that.
At issue was the loop in write_cache_pages scanning all the way to the end of the 10G file, even though the subsequent call to mpage_da_submit_io would only actually write a smallish amt; then we went back to the write_cache_pages loop ... wasting tons of time in calling __mpage_da_writepage for thousands of pages we would just revisit (many times) later.
Upstream it's not such a big issue for sys_sync because we get to the loop with a much smaller nr_to_write, which limits the loop.
However, talking with Aneesh he realized that fsync upstream still gets here with a very large nr_to_write and we face the same problem.
This patch makes mpage_add_bh_to_extent stop the loop after we've accumulated 2048 pages, by setting mpd->io_done = 1; which ultimately causes the write_cache_pages loop to break.
Repeating the test with a dirty_ratio of 80 (to leave something for fsync to do), I don't see huge IO performance gains, but the reduction in cpu usage is striking: 80% usage with stock, and 2% with the below patch. Instrumenting the loop in write_cache_pages clearly shows that we are wasting time here.
Eventually we need to change mpage_da_map_pages() also submit its I/O to the block layer, subsuming mpage_da_submit_io(), and then change it call ext4_get_blocks() multiple times.
--- fs/ext4/inode.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
fs/ext4/inode.c +9 -0
@@ -2350,6 +2350,15 @@ static void mpage_add_bh_to_extent(struct mpage_da_data *mpd,sector_t next;int nrblocks = mpd->b_size >> mpd->inode->i_blkbits; +/* +* XXX Don't go larger than mballoc is willing to allocate +* This is a stopgap solution. We eventually need to fold +* mpage_da_submit_io() into this function and then call +* ext4_get_blocks() multiple times in a loop +*/ +if (nrblocks >=8 *1024 *1024 /mpd->inode->i_sb->s_blocksize) + goto flush_it; +/* check if thereserved journal credits might overflow */ if (!(EXT4_I (mpd->inode)->i_flags &EXT4_EXTENTS_FL )) {if (nrblocks >=EXT4_MAX_TRANS_DATA ) {
Signature · 1 line
1.7.3.3
PATCH 13/260 ext4: Do not zero out uninitialized extents beyond i_size
In reply to Paul GortmakerFrom: Dmitry Monakhov <[email protected]>
commit 21ca087a3891efab4d45488db8febee474d26c68 upstream.
The extents code will sometimes zero out blocks and mark them as initialized instead of splitting an extent into several smaller ones. This optimization however, causes problems if the extent is beyond i_size because fsck will complain if there are uninitialized blocks after i_size as this can not be distinguished from an inode that has an incorrect i_size field.
https://bugzilla.kernel.org/show_bug.cgi?id=15742
--- fs/ext4/extents.c | 67 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 51 insertions(+), 16 deletions(-)
fs/ext4/extents.c +51 -16
@@ -2631,11 +2631,21 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,struct ext4_extent *ex2 =NULL ;struct ext4_extent *ex3 =NULL ;struct ext4_extent_header *eh; -ext4_lblk_t ee_block; +ext4_lblk_t ee_block, eof_block;unsigned int allocated, ee_len, depth;ext4_fsblk_t newblock;int err =0 ;int ret =0 ; +int may_zeroout; + +ext_debug ("ext4_ext_convert_to_initialized: inode %lu, logical" +"block %llu, max_blocks %u\n" , inode->i_ino, + (unsigned long long )iblock, max_blocks); + + eof_block = (inode->i_size + inode->i_sb->s_blocksize -1 ) >> + inode->i_sb->s_blocksize_bits; +if (eof_block < iblock + max_blocks) + eof_block = iblock + max_blocks; depth =ext_depth (inode); eh = path[depth].p_hdr;
@@ -2644,16 +2654,23 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, ee_len =ext4_ext_get_actual_len (ex); allocated = ee_len - (iblock - ee_block); newblock = iblock - ee_block +ext_pblock (ex); + ex2 = ex; orig_ex.ee_block = ex->ee_block; orig_ex.ee_len =cpu_to_le16 (ee_len);ext4_ext_store_pblock (&orig_ex,ext_pblock (ex)); +/* +* It is safe to convert extent to initialized via explicit +* zeroout only if extent is fully insde i_size or new_size. +*/ + may_zeroout = ee_block + ee_len <= eof_block; + err =ext4_ext_get_access (handle, inode, path + depth);if (err) goto out;/* If extent has less than 2*EXT4_EXT_ZERO_LEN zerout directly */ -if (ee_len <=2 *EXT4_EXT_ZERO_LEN ) { +if (ee_len <=2 *EXT4_EXT_ZERO_LEN && may_zeroout) { err =ext4_ext_zeroout (inode, &orig_ex);if (err) goto fix_extent_len;
@@ -2684,7 +2701,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,if (allocated > max_blocks) {unsigned int newdepth;/* If extent has less than EXT4_EXT_ZERO_LEN zerout directly */ -if (allocated <=EXT4_EXT_ZERO_LEN ) { +if (allocated <=EXT4_EXT_ZERO_LEN && may_zeroout) {/* * iblock == ee_block is handled by the zerouout * at the beginning.
@@ -2760,7 +2777,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, ex3->ee_len =cpu_to_le16 (allocated - max_blocks);ext4_ext_mark_uninitialized (ex3); err =ext4_ext_insert_extent (handle, inode, path, ex3,0 ); -if (err == -ENOSPC ) { +if (err == -ENOSPC && may_zeroout) { err =ext4_ext_zeroout (inode, &orig_ex);if (err) goto fix_extent_len;
@@ -2784,8 +2801,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,* update the extent length after successful insert of the * split extent */ - orig_ex.ee_len =cpu_to_le16 (ee_len - -ext4_ext_get_actual_len (ex3)); + ee_len -=ext4_ext_get_actual_len (ex3); + orig_ex.ee_len =cpu_to_le16 (ee_len); + may_zeroout = ee_block + ee_len <= eof_block; + depth = newdepth;ext4_ext_drop_refs (path); path =ext4_ext_find_extent (inode, iblock, path);
@@ -2809,7 +2828,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,* otherwise give the extent a chance to merge to left */ if (le16_to_cpu (orig_ex.ee_len) <=EXT4_EXT_ZERO_LEN && - iblock != ee_block) { + iblock != ee_block && may_zeroout) { err =ext4_ext_zeroout (inode, &orig_ex);if (err) goto fix_extent_len;
@@ -2878,7 +2897,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, goto out; insert: err =ext4_ext_insert_extent (handle, inode, path, &newex,0 ); -if (err == -ENOSPC ) { +if (err == -ENOSPC && may_zeroout) { err =ext4_ext_zeroout (inode, &orig_ex);if (err) goto fix_extent_len;
@@ -2938,14 +2957,21 @@ static int ext4_split_unwritten_extents(handle_t *handle,struct ext4_extent *ex2 =NULL ;struct ext4_extent *ex3 =NULL ;struct ext4_extent_header *eh; -ext4_lblk_t ee_block; +ext4_lblk_t ee_block, eof_block;unsigned int allocated, ee_len, depth;ext4_fsblk_t newblock;int err =0 ; +int may_zeroout; + +ext_debug ("ext4_split_unwritten_extents: inode %lu, logical" +"block %llu, max_blocks %u\n" , inode->i_ino, + (unsigned long long )iblock, max_blocks); + + eof_block = (inode->i_size + inode->i_sb->s_blocksize -1 ) >> + inode->i_sb->s_blocksize_bits; +if (eof_block < iblock + max_blocks) + eof_block = iblock + max_blocks; -ext_debug ("ext4_split_unwritten_extents: inode %lu," -"iblock %llu, max_blocks %u\n" , inode->i_ino, - (unsigned long long )iblock, max_blocks); depth =ext_depth (inode); eh = path[depth].p_hdr; ex = path[depth].p_ext;
@@ -2953,12 +2979,19 @@ static int ext4_split_unwritten_extents(handle_t *handle, ee_len =ext4_ext_get_actual_len (ex); allocated = ee_len - (iblock - ee_block); newblock = iblock - ee_block +ext_pblock (ex); + ex2 = ex; orig_ex.ee_block = ex->ee_block; orig_ex.ee_len =cpu_to_le16 (ee_len);ext4_ext_store_pblock (&orig_ex,ext_pblock (ex));/* +* It is safe to convert extent to initialized via explicit +* zeroout only if extent is fully insde i_size or new_size. +*/ + may_zeroout = ee_block + ee_len <= eof_block; + +/* * If the uninitialized extent begins at the same logical * block where the write begins, and the write completely * covers the extent, then we don't need to split it.
@@ -2992,7 +3025,7 @@ static int ext4_split_unwritten_extents(handle_t *handle, ex3->ee_len =cpu_to_le16 (allocated - max_blocks);ext4_ext_mark_uninitialized (ex3); err =ext4_ext_insert_extent (handle, inode, path, ex3, flags); -if (err == -ENOSPC ) { +if (err == -ENOSPC && may_zeroout) { err =ext4_ext_zeroout (inode, &orig_ex);if (err) goto fix_extent_len;
@@ -3016,8 +3049,10 @@ static int ext4_split_unwritten_extents(handle_t *handle,* update the extent length after successful insert of the * split extent */ - orig_ex.ee_len =cpu_to_le16 (ee_len - -ext4_ext_get_actual_len (ex3)); + ee_len -=ext4_ext_get_actual_len (ex3); + orig_ex.ee_len =cpu_to_le16 (ee_len); + may_zeroout = ee_block + ee_len <= eof_block; + depth = newdepth;ext4_ext_drop_refs (path); path =ext4_ext_find_extent (inode, iblock, path);
@@ -3063,7 +3098,7 @@ static int ext4_split_unwritten_extents(handle_t *handle, goto out; insert: err =ext4_ext_insert_extent (handle, inode, path, &newex, flags); -if (err == -ENOSPC ) { +if (err == -ENOSPC && may_zeroout) { err =ext4_ext_zeroout (inode, &orig_ex);if (err) goto fix_extent_len;
Signature · 1 line
1.7.3.3
PATCH 14/260 ext4: clean up inode bitmaps manipulation in ext4_free_inode
In reply to Paul GortmakerFrom: Dmitry Monakhov <[email protected]>
commit d17413c08cd2b1dd2bf2cfdbb0f7b736b2b2b15c upstream.
- Reorganize locking scheme to batch two atomic operation in to one. This also allow us to state what healthy group must obey following rule ext4_free_inodes_count(sb, gdp) == ext4_count_free(inode_bitmap, NUM);
- Fix possible undefined pointer dereference.
- Even if group descriptor stats aren't accessible we have to update inode bitmaps.
- Move non-group members update out of group_lock.
--- fs/ext4/ialloc.c | 81 ++++++++++++++++++++++++----------------------------- 1 files changed, 37 insertions(+), 44 deletions(-)
fs/ext4/ialloc.c +39 -46
@@ -240,56 +240,49 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)if (fatal) goto error_return; -/* Ok, now we can actually update the inode bitmaps.. */ - cleared =ext4_clear_bit_atomic (ext4_group_lock_ptr (sb, block_group), - bit, bitmap_bh->b_data); -if (!cleared) -ext4_error (sb,"bit already cleared for inode %lu" , ino); -else { - gdp =ext4_get_group_desc (sb, block_group, &bh2); - + fatal = -ESRCH ; + gdp =ext4_get_group_desc (sb, block_group, &bh2); +if (gdp) {BUFFER_TRACE (bh2,"get_write_access" ); fatal =ext4_journal_get_write_access (handle, bh2); -if (fatal) goto error_return; - -if (gdp) { -ext4_lock_group (sb, block_group); - count =ext4_free_inodes_count (sb, gdp) +1 ; -ext4_free_inodes_set (sb, gdp, count); -if (is_directory) { - count =ext4_used_dirs_count (sb, gdp) -1 ; -ext4_used_dirs_set (sb, gdp, count); -if (sbi->s_log_groups_per_flex) { -ext4_group_t f; - - f =ext4_flex_group (sbi, block_group); -atomic_dec (&sbi->s_flex_groups[f].used_dirs); - } + } +ext4_lock_group (sb, block_group); + cleared =ext4_clear_bit (bit, bitmap_bh->b_data); +if (fatal || !cleared) { +ext4_unlock_group (sb, block_group); + goto out; + } - } - gdp->bg_checksum =ext4_group_desc_csum (sbi, - block_group, gdp); -ext4_unlock_group (sb, block_group); -percpu_counter_inc (&sbi->s_freeinodes_counter); -if (is_directory) -percpu_counter_dec (&sbi->s_dirs_counter); - -if (sbi->s_log_groups_per_flex) { -ext4_group_t f; - - f =ext4_flex_group (sbi, block_group); -atomic_inc (&sbi->s_flex_groups[f].free_inodes); - } - } -BUFFER_TRACE (bh2,"call ext4_handle_dirty_metadata" ); - err =ext4_handle_dirty_metadata (handle,NULL , bh2); -if (!fatal) fatal = err; + count =ext4_free_inodes_count (sb, gdp) +1 ; +ext4_free_inodes_set (sb, gdp, count); +if (is_directory) { + count =ext4_used_dirs_count (sb, gdp) -1 ; +ext4_used_dirs_set (sb, gdp, count); +percpu_counter_dec (&sbi->s_dirs_counter); } -BUFFER_TRACE (bitmap_bh,"call ext4_handle_dirty_metadata" ); - err =ext4_handle_dirty_metadata (handle,NULL , bitmap_bh); -if (!fatal) - fatal = err; - sb->s_dirt =1 ; + gdp->bg_checksum =ext4_group_desc_csum (sbi, block_group, gdp); +ext4_unlock_group (sb, block_group); + +percpu_counter_inc (&sbi->s_freeinodes_counter); +if (sbi->s_log_groups_per_flex) { +ext4_group_t f =ext4_flex_group (sbi, block_group); + +atomic_inc (&sbi->s_flex_groups[f].free_inodes); +if (is_directory) +atomic_dec (&sbi->s_flex_groups[f].used_dirs); + } +BUFFER_TRACE (bh2,"call ext4_handle_dirty_metadata" ); + fatal =ext4_handle_dirty_metadata (handle,NULL , bh2); +out: +if (cleared) { +BUFFER_TRACE (bitmap_bh,"call ext4_handle_dirty_metadata" ); + err =ext4_handle_dirty_metadata (handle,NULL , bitmap_bh); +if (!fatal) + fatal = err; + sb->s_dirt =1 ; + }else +ext4_error (sb,"bit already cleared for inode %lu" , ino); + error_return:brelse (bitmap_bh);ext4_std_error (sb, fatal);
Signature · 1 line
1.7.3.3
PATCH 15/260 ext4: init statistics after journal recovery
In reply to Paul GortmakerFrom: Dmitry Monakhov <[email protected]>
commit 84061e07c5fbbbf9dc8aef8fb750fc3a2dfc31f3 upstream.
Currently block/inode/dir counters initialized before journal was recovered. In fact after journal recovery this info will probably change. And freeblocks it critical for correct delalloc mode accounting.
https://bugzilla.kernel.org/show_bug.cgi?id=15768
--- fs/ext4/super.c | 40 ++++++++++++++++++---------------------- 1 files changed, 18 insertions(+), 22 deletions(-)
fs/ext4/super.c +18 -22
@@ -2794,24 +2794,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)get_random_bytes (&sbi->s_next_generation,sizeof (u32));spin_lock_init (&sbi->s_next_gen_lock); - err =percpu_counter_init (&sbi->s_freeblocks_counter, -ext4_count_free_blocks (sb)); -if (!err) { - err =percpu_counter_init (&sbi->s_freeinodes_counter, -ext4_count_free_inodes (sb)); - } -if (!err) { - err =percpu_counter_init (&sbi->s_dirs_counter, -ext4_count_dirs (sb)); - } -if (!err) { - err =percpu_counter_init (&sbi->s_dirtyblocks_counter,0 ); - } -if (err) { -ext4_msg (sb,KERN_ERR ,"insufficient memory" ); - goto failed_mount3; - } - sbi->s_stripe =ext4_get_stripe_size (sbi); sbi->s_max_writeback_mb_bump =128 ;
@@ -2911,6 +2893,20 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)set_task_ioprio (sbi->s_journal->j_task, journal_ioprio); no_journal: + err =percpu_counter_init (&sbi->s_freeblocks_counter, +ext4_count_free_blocks (sb)); +if (!err) + err =percpu_counter_init (&sbi->s_freeinodes_counter, +ext4_count_free_inodes (sb)); +if (!err) + err =percpu_counter_init (&sbi->s_dirs_counter, +ext4_count_dirs (sb)); +if (!err) + err =percpu_counter_init (&sbi->s_dirtyblocks_counter,0 ); +if (err) { +ext4_msg (sb,KERN_ERR ,"insufficient memory" ); + goto failed_mount_wq; + }if (test_opt (sb,NOBH )) {if (!(test_opt (sb,DATA_FLAGS ) ==EXT4_MOUNT_WRITEBACK_DATA )) { ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - "
@@ -3060,6 +3056,10 @@ failed_mount_wq:jbd2_journal_destroy (sbi->s_journal); sbi->s_journal =NULL ; } +percpu_counter_destroy (&sbi->s_freeblocks_counter); +percpu_counter_destroy (&sbi->s_freeinodes_counter); +percpu_counter_destroy (&sbi->s_dirs_counter); +percpu_counter_destroy (&sbi->s_dirtyblocks_counter); failed_mount3:if (sbi->s_flex_groups) {if (is_vmalloc_addr (sbi->s_flex_groups))
@@ -3067,10 +3067,6 @@ failed_mount3:else kfree (sbi->s_flex_groups); } -percpu_counter_destroy (&sbi->s_freeblocks_counter); -percpu_counter_destroy (&sbi->s_freeinodes_counter); -percpu_counter_destroy (&sbi->s_dirs_counter); -percpu_counter_destroy (&sbi->s_dirtyblocks_counter); failed_mount2:for (i =0 ; i < db_count; i++)brelse (sbi->s_group_desc[i]);
Signature · 1 line
1.7.3.3
PATCH 16/260 ext4: Remove extraneous newlines in ext4_msg() calls
In reply to Paul GortmakerFrom: Curt Wohlgemuth <[email protected]>
commit fbe845ddf368f77f86aa7500f8fd2690f54c66a8 upstream.
Addresses-Google-Bug: #2562325
--- fs/ext4/inode.c | 6 +++--- fs/ext4/super.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/ext4/inode.c +3 -3
@@ -2283,7 +2283,7 @@ static int mpage_da_map_blocks(struct mpage_da_data *mpd)ext4_msg (mpd->inode->i_sb,KERN_CRIT ,"delayed block allocation failed for inode %lu at " "logical offset %llu with max blocks %zd with " -"error %d\n" , mpd->inode->i_ino, +"error %d" , mpd->inode->i_ino, (unsigned long long ) next, mpd->b_size >> mpd->inode->i_blkbits, err); printk(KERN_CRIT "This should not happen!! "
@@ -2951,7 +2951,7 @@ retry:if (IS_ERR (handle)) { ret =PTR_ERR (handle);ext4_msg (inode->i_sb,KERN_CRIT ,"%s: jbd2_start: " -"%ld pages, ino %lu; err %d\n" , __func__, +"%ld pages, ino %lu; err %d" , __func__, wbc->nr_to_write, inode->i_ino, ret); goto out_writepages; }
@@ -3026,7 +3026,7 @@ retry:if (pages_skipped != wbc->pages_skipped)ext4_msg (inode->i_sb,KERN_CRIT ,"This should not happen leaving %s " -"with nr_to_write = %ld ret = %d\n" , +"with nr_to_write = %ld ret = %d" , __func__, wbc->nr_to_write, ret);/* Update index */
fs/ext4/super.c +1 -1
@@ -2998,7 +2998,7 @@ no_journal: err =ext4_setup_system_zone (sb);if (err) {ext4_msg (sb,KERN_ERR ,"failed to initialize system " -"zone (%d)\n" , err); +"zone (%d)" , err); goto failed_mount4; }
Signature · 1 line
1.7.3.3
PATCH 17/260 ext4: Prevent creation of files larger than RLIMIT_FSIZE using fallocate
In reply to Paul GortmakerFrom: Nikanth Karthikesan <[email protected]>
commit 6d19c42b7cf81c39632b6d4dbc514e8449bcd346 upstream.
Currently using posix_fallocate one can bypass an RLIMIT_FSIZE limit and create a file larger than the limit. Add a check for that.
--- fs/ext4/extents.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
fs/ext4/extents.c +5 -0
@@ -3708,6 +3708,11 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)*/ credits =ext4_chunk_trans_blocks (inode, max_blocks);mutex_lock (&inode->i_mutex); + ret =inode_newsize_ok (inode, (len + offset)); +if (ret) { +mutex_unlock (&inode->i_mutex); +return ret; + } retry:while (ret >=0 && ret < max_blocks) { block = block + ret;
Signature · 1 line
1.7.3.3
PATCH 18/260 ext4: check for a good block group before loading buddy pages
In reply to Paul GortmakerFrom: Curt Wohlgemuth <[email protected]>
commit 8a57d9d61a6e361c7bb159dda797672c1df1a691 upstream.
This adds a new field in ext4_group_info to cache the largest available block range in a block group; and don't load the buddy pages until *after* we've done a sanity check on the block group.
With large allocation requests (e.g., fallocate(), 8MiB) and relatively full partitions, it's easy to have no block groups with a block extent large enough to satisfy the input request length. This currently causes the loop during cr == 0 in ext4_mb_regular_allocator() to load the buddy bitmap pages for EVERY block group. That can be a lot of pages. The patch below allows us to call ext4_mb_good_group() BEFORE we load the buddy pages (although we have check again after we lock the block group).
Addresses-Google-Bug: #2578108
Addresses-Google-Bug: #2704453
--- fs/ext4/ext4.h | 1 + fs/ext4/mballoc.c | 70 +++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 13 deletions(-)
fs/ext4/ext4.h +1 -0
@@ -1678,6 +1678,7 @@ struct ext4_group_info {ext4_grpblk_t bb_first_free;/* first free block */ ext4_grpblk_t bb_free;/* total free blocks */ ext4_grpblk_t bb_fragments;/* nr of freespace fragments */ +ext4_grpblk_t bb_largest_free_order;/* order of largest frag in BG */ struct list_head bb_prealloc_list;#ifdef DOUBLE_CHECK void *bb_bitmap;
fs/ext4/mballoc.c +57 -13
160 lines not on this page · raw message
Signature · 1 line
1.7.3.3
PATCH 19/260 ext4: Show journal_checksum option
In reply to Paul GortmakerFrom: Jan Kara <[email protected]>
commit 39a4bade8c1826b658316d66ee81c09b0a4d7d42 upstream.
We failed to show journal_checksum option in /proc/mounts. Fix it.
--- fs/ext4/super.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/ext4/super.c +2 -0
@@ -942,6 +942,8 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)seq_puts (seq,test_opt (sb,BARRIER ) ?"1" :"0" );if (test_opt (sb,JOURNAL_ASYNC_COMMIT ))seq_puts (seq,",journal_async_commit" ); +else if (test_opt (sb,JOURNAL_CHECKSUM )) +seq_puts (seq,",journal_checksum" );if (test_opt (sb,NOBH ))seq_puts (seq,",nobh" );if (test_opt (sb,I_VERSION ))
Signature · 1 line
1.7.3.3
PATCH 20/260 ext4: Use bitops to read/modify i_flags in struct ext4_inode_info
In reply to Paul GortmakerFrom: Dmitry Monakhov <[email protected]>
commit 12e9b892002d9af057655d35b44db8ee9243b0dc upstream.
At several places we modify EXT4_I(inode)->i_flags without holding i_mutex (ext4_do_update_inode, ...). These modifications are racy and we can lose updates to i_flags. So convert handling of i_flags to use bitops which are atomic.
https://bugzilla.kernel.org/show_bug.cgi?id=15792
--- fs/ext4/dir.c | 4 +- fs/ext4/ext4.h | 109 ++++++++++++++++++++++++++++++++++++++++++------- fs/ext4/ext4_jbd2.h | 8 ++-- fs/ext4/extents.c | 10 ++-- fs/ext4/file.c | 2 +- fs/ext4/ialloc.c | 4 +- fs/ext4/inode.c | 30 +++++++------- fs/ext4/mballoc.c | 4 +- fs/ext4/migrate.c | 2 +- fs/ext4/move_extent.c | 4 +- fs/ext4/namei.c | 10 ++-- fs/ext4/super.c | 1 + fs/ext4/xattr.c | 4 +- 13 files changed, 136 insertions(+), 56 deletions(-)
fs/ext4/dir.c +2 -2
@@ -111,7 +111,7 @@ static int ext4_readdir(struct file *filp,if (EXT4_HAS_COMPAT_FEATURE (inode->i_sb,EXT4_FEATURE_COMPAT_DIR_INDEX ) && - ((EXT4_I (inode)->i_flags &EXT4_INDEX_FL ) || + ((ext4_test_inode_flag (inode,EXT4_INODE_INDEX )) || ((inode->i_size >> sb->s_blocksize_bits) ==1 ))) { err =ext4_dx_readdir (filp, dirent, filldir);if (err !=ERR_BAD_DX_DIR ) {
@@ -122,7 +122,7 @@ static int ext4_readdir(struct file *filp,* We don't set the inode dirty flag since it's not * critical that it get flushed back to the disk. */ -EXT4_I (filp->f_path.dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL ; +ext4_clear_inode_flag (filp->f_path.dentry->d_inode,EXT4_INODE_INDEX ); } stored =0 ; offset = filp->f_pos & (sb->s_blocksize -1 );
fs/ext4/ext4.h +94 -15
142 lines not on this page · raw message
fs/ext4/ext4_jbd2.h +4 -4
@@ -273,7 +273,7 @@ static inline int ext4_should_journal_data(struct inode *inode)return 1 ;if (test_opt (inode->i_sb,DATA_FLAGS ) ==EXT4_MOUNT_JOURNAL_DATA )return 1 ; -if (EXT4_I (inode)->i_flags &EXT4_JOURNAL_DATA_FL ) +if (ext4_test_inode_flag (inode,EXT4_INODE_JOURNAL_DATA ))return 1 ;return 0 ; }
@@ -284,7 +284,7 @@ static inline int ext4_should_order_data(struct inode *inode)return 0 ;if (!S_ISREG (inode->i_mode))return 0 ; -if (EXT4_I (inode)->i_flags &EXT4_JOURNAL_DATA_FL ) +if (ext4_test_inode_flag (inode,EXT4_INODE_JOURNAL_DATA ))return 0 ;if (test_opt (inode->i_sb,DATA_FLAGS ) ==EXT4_MOUNT_ORDERED_DATA )return 1 ;
@@ -297,7 +297,7 @@ static inline int ext4_should_writeback_data(struct inode *inode)return 0 ;if (EXT4_JOURNAL (inode) ==NULL )return 1 ; -if (EXT4_I (inode)->i_flags &EXT4_JOURNAL_DATA_FL ) +if (ext4_test_inode_flag (inode,EXT4_INODE_JOURNAL_DATA ))return 0 ;if (test_opt (inode->i_sb,DATA_FLAGS ) ==EXT4_MOUNT_WRITEBACK_DATA )return 1 ;
@@ -321,7 +321,7 @@ static inline int ext4_should_dioread_nolock(struct inode *inode)return 0 ;if (!S_ISREG (inode->i_mode))return 0 ; -if (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )) +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )))return 0 ;if (ext4_should_journal_data (inode))return 0 ;
fs/ext4/extents.c +5 -5
@@ -3509,7 +3509,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,set_buffer_uninit (bh_result); } -if (unlikely (EXT4_I (inode)->i_flags &EXT4_EOFBLOCKS_FL )) { +if (unlikely (ext4_test_inode_flag (inode,EXT4_INODE_EOFBLOCKS ))) {if (unlikely (!eh->eh_entries)) { EXT4_ERROR_INODE(inode, "eh->eh_entries == 0 ee_block %d",
@@ -3520,7 +3520,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, last_ex =EXT_LAST_EXTENT (eh);if (iblock + ar.len >le32_to_cpu (last_ex->ee_block) +ext4_ext_get_actual_len (last_ex)) -EXT4_I (inode)->i_flags &= ~EXT4_EOFBLOCKS_FL ; +ext4_clear_inode_flag (inode,EXT4_INODE_EOFBLOCKS ); } err =ext4_ext_insert_extent (handle, inode, path, &newex, flags);if (err) {
@@ -3661,7 +3661,7 @@ static void ext4_falloc_update_inode(struct inode *inode,* can proceed even if the new size is the same as i_size. */ if (new_size >i_size_read (inode)) -EXT4_I (inode)->i_flags |=EXT4_EOFBLOCKS_FL ; +ext4_set_inode_flag (inode,EXT4_INODE_EOFBLOCKS ); } }
@@ -3689,7 +3689,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)* currently supporting (pre)allocate mode for extent-based * files _only_ */ -if (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )) +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )))return -EOPNOTSUPP ;/* preallocation to directories is currently not supported */
@@ -3939,7 +3939,7 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,int error =0 ;/* fallback to generic here if not in extents fmt */ -if (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )) +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )))return generic_block_fiemap (inode, fieinfo, start, len, ext4_get_block);
fs/ext4/file.c +1 -1
@@ -66,7 +66,7 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov,* is smaller than s_maxbytes, which is for extent-mapped files. */ -if (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )) { +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))) {struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb);size_t length =iov_length (iov, nr_segs);
fs/ext4/ialloc.c +2 -2
@@ -492,7 +492,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent,if (S_ISDIR (mode) && ((parent == sb->s_root->d_inode) || - (EXT4_I (parent)->i_flags &EXT4_TOPDIR_FL ))) { + (ext4_test_inode_flag (parent,EXT4_INODE_TOPDIR )))) {int best_ndir = inodes_per_group;int ret =-1 ;
@@ -1038,7 +1038,7 @@ got:if (EXT4_HAS_INCOMPAT_FEATURE (sb,EXT4_FEATURE_INCOMPAT_EXTENTS )) {/* set extent flag only for directory, file and normal symlink*/ if (S_ISDIR (mode) ||S_ISREG (mode) ||S_ISLNK (mode)) { -EXT4_I (inode)->i_flags |=EXT4_EXTENTS_FL ; +ext4_set_inode_flag (inode,EXT4_INODE_EXTENTS );ext4_ext_tree_init (handle, inode); } }
fs/ext4/inode.c +15 -15
@@ -933,7 +933,7 @@ static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode,int count =0 ;ext4_fsblk_t first_block =0 ; -J_ASSERT (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )); +J_ASSERT (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )));J_ASSERT (handle !=NULL || (flags &EXT4_GET_BLOCKS_CREATE ) ==0 ); depth =ext4_block_to_path (inode, iblock, offsets, &blocks_to_boundary);
@@ -1061,7 +1061,7 @@ static int ext4_indirect_calc_metadata_amount(struct inode *inode,*/ static int ext4_calc_metadata_amount (struct inode *inode,sector_t lblock) { -if (EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL ) +if (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))return ext4_ext_calc_metadata_amount (inode, lblock);return ext4_indirect_calc_metadata_amount (inode, lblock);
@@ -1251,7 +1251,7 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,* file system block. */ down_read ((&EXT4_I (inode)->i_data_sem)); -if (EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL ) { +if (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )) { retval =ext4_ext_get_blocks (handle, inode, block, max_blocks, bh,0 ); }else {
@@ -1313,7 +1313,7 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,* We need to check for EXT4 here because migrate * could have changed the inode type in between */ -if (EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL ) { +if (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )) { retval =ext4_ext_get_blocks (handle, inode, block, max_blocks, bh, flags); }else {
@@ -2360,7 +2360,7 @@ static void mpage_add_bh_to_extent(struct mpage_da_data *mpd, goto flush_it;/* check if thereserved journal credits might overflow */ -if (!(EXT4_I (mpd->inode)->i_flags &EXT4_EXTENTS_FL )) { +if (!(ext4_test_inode_flag (mpd->inode,EXT4_INODE_EXTENTS ))) {if (nrblocks >=EXT4_MAX_TRANS_DATA ) {/* * With non-extent format we are limited by the journal
@@ -2831,7 +2831,7 @@ static int ext4_da_writepages_trans_blocks(struct inode *inode)* number of contiguous block. So we will limit * number of contiguous block to a sane value */ -if (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL ) && +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )) && (max_blocks >EXT4_MAX_TRANS_DATA )) max_blocks =EXT4_MAX_TRANS_DATA ;
@@ -3983,7 +3983,7 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,struct file *file = iocb->ki_filp;struct inode *inode = file->f_mapping->host; -if (EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL ) +if (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))return ext4_ext_direct_IO (rw, iocb, iov, offset, nr_segs);return ext4_ind_direct_IO (rw, iocb, iov, offset, nr_segs);
@@ -4622,12 +4622,12 @@ void ext4_truncate(struct inode *inode)if (!ext4_can_truncate (inode))return ; -EXT4_I (inode)->i_flags &= ~EXT4_EOFBLOCKS_FL ; +ext4_clear_inode_flag (inode,EXT4_INODE_EOFBLOCKS );if (inode->i_size ==0 && !test_opt (inode->i_sb,NO_AUTO_DA_ALLOC ))ext4_set_inode_state (inode,EXT4_STATE_DA_ALLOC_CLOSE ); -if (EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL ) { +if (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )) {ext4_ext_truncate (inode);return ; }
@@ -5465,7 +5465,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) }if (attr->ia_valid &ATTR_SIZE ) { -if (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )) { +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))) {struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb);if (attr->ia_size > sbi->s_bitmap_maxbytes) {
@@ -5478,7 +5478,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)if (S_ISREG (inode->i_mode) && attr->ia_valid &ATTR_SIZE && (attr->ia_size < inode->i_size || - (EXT4_I (inode)->i_flags &EXT4_EOFBLOCKS_FL ))) { + (ext4_test_inode_flag (inode,EXT4_INODE_EOFBLOCKS )))) {handle_t *handle; handle =ext4_journal_start (inode,3 );
@@ -5510,7 +5510,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) } }/* ext4_truncate will clear the flag */ -if ((EXT4_I (inode)->i_flags &EXT4_EOFBLOCKS_FL )) +if ((ext4_test_inode_flag (inode,EXT4_INODE_EOFBLOCKS )))ext4_truncate (inode); }
@@ -5586,7 +5586,7 @@ static int ext4_indirect_trans_blocks(struct inode *inode, int nrblocks,static int ext4_index_trans_blocks (struct inode *inode,int nrblocks,int chunk) { -if (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )) +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )))return ext4_indirect_trans_blocks (inode, nrblocks, chunk);return ext4_ext_index_trans_blocks (inode, nrblocks, chunk); }
@@ -5921,9 +5921,9 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)*/ if (val) -EXT4_I (inode)->i_flags |=EXT4_JOURNAL_DATA_FL ; +ext4_set_inode_flag (inode,EXT4_INODE_JOURNAL_DATA );else -EXT4_I (inode)->i_flags &= ~EXT4_JOURNAL_DATA_FL ; +ext4_clear_inode_flag (inode,EXT4_INODE_JOURNAL_DATA );ext4_set_aops (inode);jbd2_journal_unlock_updates (journal);
fs/ext4/mballoc.c +2 -2
@@ -2006,7 +2006,7 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac) sbi =EXT4_SB (sb); ngroups =ext4_get_groups_count (sb);/* non-extent files are limited to low blocks/groups */ -if (!(EXT4_I (ac->ac_inode)->i_flags &EXT4_EXTENTS_FL )) +if (!(ext4_test_inode_flag (ac->ac_inode,EXT4_INODE_EXTENTS ))) ngroups = sbi->s_blockfile_groups;BUG_ON (ac->ac_status ==AC_STATUS_FOUND );
@@ -3171,7 +3171,7 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)continue ;/* non-extent files can't have physical blocks past 2^32 */ -if (!(EXT4_I (ac->ac_inode)->i_flags &EXT4_EXTENTS_FL ) && +if (!(ext4_test_inode_flag (ac->ac_inode,EXT4_INODE_EXTENTS )) && pa->pa_pstart + pa->pa_len >EXT4_MAX_BLOCK_FILE_PHYS )continue ;
fs/ext4/migrate.c +1 -1
@@ -475,7 +475,7 @@ int ext4_ext_migrate(struct inode *inode)*/ if (!EXT4_HAS_INCOMPAT_FEATURE (inode->i_sb,EXT4_FEATURE_INCOMPAT_EXTENTS ) || - (EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )) + (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )))return -EINVAL ;if (S_ISLNK (inode->i_mode) && inode->i_blocks ==0 )
fs/ext4/move_extent.c +2 -2
@@ -979,11 +979,11 @@ mext_check_arguments(struct inode *orig_inode, }/* Ext4 move extent supports only extent based file */ -if (!(EXT4_I (orig_inode)->i_flags &EXT4_EXTENTS_FL )) { +if (!(ext4_test_inode_flag (orig_inode,EXT4_INODE_EXTENTS ))) {ext4_debug ("ext4 move extent: orig file is not extents " "based file [ino:orig %lu]\n" , orig_inode->i_ino);return -EOPNOTSUPP ; - }else if (!(EXT4_I (donor_inode)->i_flags &EXT4_EXTENTS_FL )) { + }else if (!(ext4_test_inode_flag (donor_inode,EXT4_INODE_EXTENTS ))) {ext4_debug ("ext4 move extent: donor file is not extents " "based file [ino:donor %lu]\n" , donor_inode->i_ino);return -EOPNOTSUPP ;
fs/ext4/namei.c +5 -5
@@ -656,7 +656,7 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,dxtrace (printk (KERN_DEBUG "In htree_fill_tree, start hash: %x:%x\n" , start_hash, start_minor_hash)); dir = dir_file->f_path.dentry->d_inode; -if (!(EXT4_I (dir)->i_flags &EXT4_INDEX_FL )) { +if (!(ext4_test_inode_flag (dir,EXT4_INODE_INDEX ))) { hinfo.hash_version =EXT4_SB (dir->i_sb)->s_def_hash_version;if (hinfo.hash_version <=DX_HASH_TEA ) hinfo.hash_version +=
@@ -801,7 +801,7 @@ static void ext4_update_dx_flag(struct inode *inode) {if (!EXT4_HAS_COMPAT_FEATURE (inode->i_sb,EXT4_FEATURE_COMPAT_DIR_INDEX )) -EXT4_I (inode)->i_flags &= ~EXT4_INDEX_FL ; +ext4_clear_inode_flag (inode,EXT4_INODE_INDEX ); }/*
@@ -1418,7 +1418,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,brelse (bh);return retval; } -EXT4_I (dir)->i_flags |=EXT4_INDEX_FL ; +ext4_set_inode_flag (dir,EXT4_INODE_INDEX ); data1 = bh2->b_data;memcpy (data1, de, len);
@@ -1491,7 +1491,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, retval =ext4_dx_add_entry (handle, dentry, inode);if (!retval || (retval !=ERR_BAD_DX_DIR ))return retval; -EXT4_I (dir)->i_flags &= ~EXT4_INDEX_FL ; +ext4_clear_inode_flag (dir,EXT4_INODE_INDEX ); dx_fallback++;ext4_mark_inode_dirty (handle, dir); }
@@ -2297,7 +2297,7 @@ retry: } }else {/* clear the extent format for fast symlink */ -EXT4_I (inode)->i_flags &= ~EXT4_EXTENTS_FL ; +ext4_clear_inode_flag (inode,EXT4_INODE_EXTENTS ); inode->i_op = &ext4_fast_symlink_inode_operations;memcpy ((char *)&EXT4_I (inode)->i_data, symname, l); inode->i_size = l-1 ;
fs/ext4/super.c +1 -0
@@ -4139,6 +4139,7 @@ static int __init init_ext4_fs(void) {int err; +ext4_check_flag_values (); err =init_ext4_system_zone ();if (err)return err;
fs/ext4/xattr.c +2 -2
@@ -820,7 +820,7 @@ inserted: EXT4_I(inode)->i_block_group);/* non-extent files can't have physical blocks past 2^32 */ -if (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )) +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))) goal = goal &EXT4_MAX_BLOCK_FILE_PHYS ; block = ext4_new_meta_blocks(handle, inode,
@@ -828,7 +828,7 @@ inserted:if (error) goto cleanup; -if (!(EXT4_I (inode)->i_flags &EXT4_EXTENTS_FL )) +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )))BUG_ON (block >EXT4_MAX_BLOCK_FILE_PHYS );ea_idebug (inode,"creating block %d" , block);
Signature · 1 line
1.7.3.3
PATCH 21/260 ext4: Avoid crashing on NULL ptr dereference on a filesystem error
In reply to Paul GortmakerFrom: Theodore Ts'o <[email protected]>
commit f70f362b4a6fe47c239dbfb3efc0cc2c10e4f09c upstream.
If the EOFBLOCK_FL flag is set when it should not be and the inode is zero length, then eh_entries is zero, and ex is NULL, so dereferencing ex to print ex->ee_block causes a kernel OOPS in ext4_ext_map_blocks().
On top of that, the error message which is printed isn't very helpful. So we fix this by printing something more explanatory which doesn't involve trying to print ex->ee_block.
Addresses-Google-Bug: #2655740
--- fs/ext4/extents.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
fs/ext4/extents.c +5 -4
@@ -3381,8 +3381,9 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,*/ if (unlikely (path[depth].p_ext ==NULL && depth !=0 )) {EXT4_ERROR_INODE (inode,"bad extent address " -"iblock: %d, depth: %d pblock %lld" , - iblock, depth, path[depth].p_block); +"iblock: %lu, depth: %d pblock %lld" , + (unsigned long ) iblock, depth, + path[depth].p_block); err = -EIO ; goto out2; }
@@ -3512,8 +3513,8 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,if (unlikely (ext4_test_inode_flag (inode,EXT4_INODE_EOFBLOCKS ))) {if (unlikely (!eh->eh_entries)) {EXT4_ERROR_INODE (inode, -"eh->eh_entries == 0 ee_block %d" , - ex->ee_block); +"eh->eh_entries == 0 and " +"EOFBLOCKS_FL set" ); err = -EIO ; goto out2; }
Signature · 1 line
1.7.3.3
PATCH 22/260 ext4: Clear the EXT4_EOFBLOCKS_FL flag only when warranted
In reply to Paul GortmakerFrom: Theodore Ts'o <[email protected]>
commit 786ec7915e530936b9eb2e3d12274145cab7aa7d upstream.
Dimitry Monakhov discovered an edge case where it was possible for the EXT4_EOFBLOCKS_FL flag could get cleared unnecessarily. This is true; I have a test case that can be exercised via downloading and decompressing the file:
wget ftp://ftp.kernel.org/pub/linux/kernel/people/tytso/ext4-testcases/eofblocks-fl-test-case.img.bz2 bunzip2 eofblocks-fl-test-case.img
dd if=/dev/zero of=eofblocks-fl-test-case.img bs=1k seek=17925 bs=1k count=1 conv=notrunc
However, triggering it in real life is highly unlikely since it requires an extremely fragmented sparse file with a hole in exactly the right place in the extent tree. (It actually took quite a bit of work to generate this test case.) Still, it's nice to get even extreme corner cases to be correct, so this patch makes sure that we don't clear the EXT4_EOFBLOCKS_FL incorrectly even in this corner case.
--- fs/ext4/extents.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-)
fs/ext4/extents.c +15 -3
@@ -3329,7 +3329,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,struct ext4_extent_header *eh;struct ext4_extent newex, *ex, *last_ex;ext4_fsblk_t newblock; -int err =0 , depth, ret, cache_type; +int i, err =0 , depth, ret, cache_type;unsigned int allocated =0 ;struct ext4_allocation_request ar;ext4_io_end_t *io =EXT4_I (inode)->cur_aio_dio;
@@ -3519,8 +3519,20 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, goto out2; } last_ex =EXT_LAST_EXTENT (eh); -if (iblock + ar.len >le32_to_cpu (last_ex->ee_block) - +ext4_ext_get_actual_len (last_ex)) +/* +* If the current leaf block was reached by looking at +* the last index block all the way down the tree, and +* we are extending the inode beyond the last extent +* in the current leaf block, then clear the +* EOFBLOCKS_FL flag. +*/ +for (i = depth-1 ; i >=0 ; i--) { +if (path[i].p_idx !=EXT_LAST_INDEX (path[i].p_hdr)) +break ; + } +if ((i <0 ) && + (iblock + ar.len >le32_to_cpu (last_ex->ee_block) + +ext4_ext_get_actual_len (last_ex)))ext4_clear_inode_flag (inode,EXT4_INODE_EOFBLOCKS ); } err =ext4_ext_insert_extent (handle, inode, path, &newex, flags);
Signature · 1 line
1.7.3.3
PATCH 23/260 ext4: restart ext4_ext_remove_space() after transaction restart
In reply to Paul GortmakerFrom: Dmitry Monakhov <[email protected]>
commit 0617b83fa239db9743a18ce6cc0e556f4d0fd567 upstream.
If i_data_sem was internally dropped due to transaction restart, it is necessary to restart path look-up because extents tree was possibly modified by ext4_get_block().
https://bugzilla.kernel.org/show_bug.cgi?id=15827
--- fs/ext4/extents.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
fs/ext4/extents.c +9 -7
@@ -107,11 +107,8 @@ static int ext4_ext_truncate_extend_restart(handle_t *handle,if (err <=0 )return err; err =ext4_truncate_restart_trans (handle, inode, needed); -/* -* We have dropped i_data_sem so someone might have cached again -* an extent we are going to truncate. -*/ -ext4_ext_invalidate_cache (inode); +if (err ==0 ) + err = -EAGAIN ;return err; }
@@ -2361,7 +2358,7 @@ static int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start)int depth =ext_depth (inode);struct ext4_ext_path *path;handle_t *handle; -int i =0 , err =0 ; +int i, err;ext_debug ("truncate since %u\n" , start);
@@ -2370,23 +2367,26 @@ static int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start)if (IS_ERR (handle))return PTR_ERR (handle); +again:ext4_ext_invalidate_cache (inode);/* * We start scanning from right side, freeing all the blocks * after i_size and walking into the tree depth-wise. */ + depth =ext_depth (inode); path =kzalloc (sizeof (struct ext4_ext_path ) * (depth +1 ),GFP_NOFS );if (path ==NULL ) {ext4_journal_stop (handle);return -ENOMEM ; } + path[0 ].p_depth = depth; path[0 ].p_hdr =ext_inode_hdr (inode);if (ext4_ext_check (inode, path[0 ].p_hdr, depth)) { err = -EIO ; goto out; } - path[0 ].p_depth = depth; + i = err =0 ;while (i >=0 && err ==0 ) {if (i == depth) {
@@ -2480,6 +2480,8 @@ static int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start) out:ext4_ext_drop_refs (path);kfree (path); +if (err == -EAGAIN ) + goto again;ext4_journal_stop (handle);return err;
Signature · 1 line
1.7.3.3
PATCH 24/260 ext4: Conditionally define compat ioctl numbers
In reply to Paul GortmakerFrom: Ben Hutchings <[email protected]>
commit 899ad0cea6ad7ff4ba24b16318edbc3cbbe03fad upstream.
It is unnecessary, and in general impossible, to define the compat ioctl numbers except when building the filesystem with CONFIG_COMPAT defined.
--- fs/ext4/ext4.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/ext4/ext4.h +2 -0
@@ -475,6 +475,7 @@ struct ext4_new_group_data {#define EXT4_IOC_ALLOC_DA_BLKS _IO('f', 12)#define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent) +#if defined(__KERNEL__) && defined(CONFIG_COMPAT )/* * ioctl commands in 32 bit emulation */
@@ -490,6 +491,7 @@ struct ext4_new_group_data {#endif #define EXT4_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION#define EXT4_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION +#endif /*
Signature · 1 line
1.7.3.3
PATCH 25/260 ext4: Fix compat EXT4_IOC_ADD_GROUP
In reply to Paul GortmakerFrom: Ben Hutchings <[email protected]>
commit 4d92dc0f00a775dc2e1267b0e00befb783902fe7 upstream.
struct ext4_new_group_input needs to be converted because u64 has only 32-bit alignment on some 32-bit architectures, notably i386.
--- fs/ext4/ext4.h | 16 ++++++++++++++++ fs/ext4/ioctl.c | 25 +++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-)
fs/ext4/ext4.h +16 -0
@@ -29,6 +29,9 @@#include <linux/wait.h> #include <linux/blockgroup_lock.h> #include <linux/percpu_counter.h> +#ifdef __KERNEL__ +#include <linux/compat.h> +#endif /* * The fourth extended filesystem constants/structures
@@ -409,6 +412,18 @@ struct ext4_new_group_input {__u16 unused; }; +#if defined(__KERNEL__) && defined(CONFIG_COMPAT ) +struct compat_ext4_new_group_input { +u32 group; +compat_u64 block_bitmap; +compat_u64 inode_bitmap; +compat_u64 inode_table; +u32 blocks_count; +u16 reserved_blocks; +u16 unused; +}; +#endif +/* The struct ext4_new_group_input in kernel space, with free_blocks_count */ struct ext4_new_group_data {__u32 group;
@@ -486,6 +501,7 @@ struct ext4_new_group_data {#define EXT4_IOC32_GETRSVSZ _IOR('f', 5, int)#define EXT4_IOC32_SETRSVSZ _IOW('f', 6, int)#define EXT4_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int) +#define EXT4_IOC32_GROUP_ADD _IOW('f', 8, struct compat_ext4_new_group_input)#ifdef CONFIG_JBD2_DEBUG #define EXT4_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)#endif
fs/ext4/ioctl.c +23 -2
@@ -373,8 +373,29 @@ long ext4_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)case EXT4_IOC32_SETRSVSZ : cmd =EXT4_IOC_SETRSVSZ ;break ; -case EXT4_IOC_GROUP_ADD : -break ; +case EXT4_IOC32_GROUP_ADD : { +struct compat_ext4_new_group_input __user *uinput; +struct ext4_new_group_input input; +mm_segment_t old_fs; +int err; + + uinput =compat_ptr (arg); + err =get_user (input.group, &uinput->group); + err |=get_user (input.block_bitmap, &uinput->block_bitmap); + err |=get_user (input.inode_bitmap, &uinput->inode_bitmap); + err |=get_user (input.inode_table, &uinput->inode_table); + err |=get_user (input.blocks_count, &uinput->blocks_count); + err |=get_user (input.reserved_blocks, + &uinput->reserved_blocks); +if (err) +return -EFAULT ; + old_fs =get_fs (); +set_fs (KERNEL_DS ); + err =ext4_ioctl (file,EXT4_IOC_GROUP_ADD , + (unsigned long ) &input); +set_fs (old_fs); +return err; + }case EXT4_IOC_MOVE_EXT :break ;default :
Signature · 1 line
1.7.3.3
PATCH 26/260 ext4: Make fsync sync new parent directories in no-journal mode
In reply to Paul GortmakerFrom: Frank Mayhar <[email protected]>
commit 14ece1028b3ed53ffec1b1213ffc6acaf79ad77c upstream.
Add a new ext4 state to tell us when a file has been newly created; use that state in ext4_sync_file in no-journal mode to tell us when we need to sync the parent directory as well as the inode and data itself. This fixes a problem in which a panic or power failure may lose the entire file even when using fsync, since the parent directory entry is lost.
Addresses-Google-Bug: #2480057
--- fs/ext4/ext4.h | 1 + fs/ext4/fsync.c | 31 +++++++++++++++++++++++++++++-- fs/ext4/namei.c | 2 ++ 3 files changed, 32 insertions(+), 2 deletions(-)
fs/ext4/ext4.h +1 -0
@@ -1157,6 +1157,7 @@ enum {EXT4_STATE_DA_ALLOC_CLOSE ,/* Alloc DA blks on close */ EXT4_STATE_EXT_MIGRATE ,/* Inode is migrating */ EXT4_STATE_DIO_UNWRITTEN ,/* need convert on dio done*/ + EXT4_STATE_NEWENTRY, /* File just added to dir */ };#define EXT4_INODE_BIT_FNS (name, field) \
fs/ext4/fsync.c +29 -2
@@ -35,6 +35,29 @@#include <trace/events/ext4.h> /* +* If we're not journaling and this is a just-created file, we have to +* sync our parent directory (if it was freshly created) since +* otherwise it will only be written by writeback, leaving a huge +* window during which a crash may lose the file. This may apply for +* the parent directory's parent as well, and so on recursively, if +* they are also freshly created. +*/ +static void ext4_sync_parent (struct inode *inode) +{ +struct dentry *dentry =NULL ; + +while (inode &&ext4_test_inode_state (inode,EXT4_STATE_NEWENTRY )) { +ext4_clear_inode_state (inode,EXT4_STATE_NEWENTRY ); + dentry =list_entry (inode->i_dentry.next, + struct dentry, d_alias); +if (!dentry || !dentry->d_parent || !dentry->d_parent->d_inode) +break ; + inode = dentry->d_parent->d_inode; +sync_mapping_buffers (inode->i_mapping); + } +} + +/* * akpm: A new design for ext4_sync_file(). * * This is only called from sys_fsync(), sys_fdatasync() and sys_msync().
@@ -67,8 +90,12 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)if (ret <0 )return ret; -if (!journal) -return simple_fsync (file, dentry, datasync); +if (!journal) { + ret =simple_fsync (file, dentry, datasync); +if (!ret && !list_empty (&inode->i_dentry)) +ext4_sync_parent (inode); +return ret; + }/* * data=writeback,ordered:
fs/ext4/namei.c +2 -0
@@ -1519,6 +1519,8 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, de->rec_len =ext4_rec_len_to_disk (blocksize, blocksize); retval =add_dirent_to_buf (handle, dentry, inode, de, bh);brelse (bh); +if (retval ==0 ) +ext4_set_inode_state (inode,EXT4_STATE_NEWENTRY );return retval; }
Signature · 1 line
1.7.3.3
PATCH 27/260 CIFS: Remove __exit mark from cifs_exit_dns_resolver()
In reply to Paul GortmakerFrom: David Howells <[email protected]>
commit 51c20fcced5badee0e2021c6c89f44aa3cbd72aa upstream.
Remove the __exit mark from cifs_exit_dns_resolver() as it's called by the module init routine in case of error, and so may have been discarded during linkage.
--- fs/cifs/dns_resolve.c | 2 +- fs/cifs/dns_resolve.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/cifs/dns_resolve.c +1 -1
@@ -227,7 +227,7 @@ failed_put_cred:return ret; } -void __exit cifs_exit_dns_resolver(void) +void cifs_exit_dns_resolver (void ) {key_revoke (dns_resolver_cache->thread_keyring);unregister_key_type (&key_type_dns_resolver);
fs/cifs/dns_resolve.h +1 -1
@@ -25,7 +25,7 @@#ifdef __KERNEL__extern int __init cifs_init_dns_resolver (void ); -extern void __exit cifs_exit_dns_resolver(void); +extern void cifs_exit_dns_resolver (void );extern int dns_resolve_server_name_to_ip (const char *unc,char **ip_addr);#endif /* KERNEL */
Signature · 1 line
1.7.3.3
PATCH 28/260 ext4: fix freeze deadlock under IO
In reply to Paul GortmakerFrom: Eric Sandeen <[email protected]>
commit 437f88cc031ffe7f37f3e705367f4fe1f4be8b0f upstream. [The 6b0310fb below references the mainline version of what has also been cherry picked into this 34-stable branch]
Commit 6b0310fbf087ad6 caused a regression resulting in deadlocks when freezing a filesystem which had active IO; the vfs_check_frozen level (SB_FREEZE_WRITE) did not let the freeze-related IO syncing through. Duh.
Changing the test to FREEZE_TRANS should let the normal freeze syncing get through the fs, but still block any transactions from starting once the fs is completely frozen.
I tested this by running fsstress in the background while periodically snapshotting the fs and running fsck on the result. I ran into occasional deadlocks, but different ones. I think this is a fine fix for the problem at hand, and the other deadlocky things will need more investigation.
--- fs/ext4/super.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext4/super.c +2 -2
@@ -241,7 +241,7 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks)if (sb->s_flags &MS_RDONLY )return ERR_PTR (-EROFS ); -vfs_check_frozen (sb,SB_FREEZE_WRITE ); +vfs_check_frozen (sb,SB_FREEZE_TRANS );/* Special case here: if the journal has aborted behind our * backs (eg. EIO in the commit thread), then we still need to * take the FS itself readonly cleanly. */
@@ -3485,7 +3485,7 @@ int ext4_force_commit(struct super_block *sb) journal =EXT4_SB (sb)->s_journal;if (journal) { -vfs_check_frozen (sb,SB_FREEZE_WRITE ); +vfs_check_frozen (sb,SB_FREEZE_TRANS ); ret =ext4_journal_force_commit (journal); }
Signature · 1 line
1.7.3.3
PATCH 29/260 hwmon: (k8temp) Differentiate between AM2 and ASB1
In reply to Paul GortmakerFrom: Andreas Herrmann <[email protected]>
commit a05e93f3b3fc2f53c1d0de3b17019e207c482349 upstream.
Commit 8bf0223ed515be24de0c671eedaff49e78bebc9c (hwmon, k8temp: Fix temperature reporting for ASB1 processor revisions) fixed temperature reporting for ASB1 CPUs. But those CPU models (model 0x6b, 0x6f, 0x7f) were packaged both as AM2 (desktop) and ASB1 (mobile). Thus the commit leads to wrong temperature reporting for AM2 CPU parts.
The solution is to determine the package type for models 0x6b, 0x6f, 0x7f.
This is done using BrandId from CPUID Fn8000_0001_EBX[15:0]. See "Constructing the processor Name String" in "Revision Guide for AMD NPT Family 0Fh Processors" (Rev. 3.46).
--- drivers/hwmon/k8temp.c | 35 ++++++++++++++++++++++++++++++++--- 1 files changed, 32 insertions(+), 3 deletions(-)
drivers/hwmon/k8temp.c +32 -3
@@ -143,6 +143,37 @@ static const struct pci_device_id k8temp_ids[] = {MODULE_DEVICE_TABLE (pci, k8temp_ids); +static int __devinit is_rev_g_desktop (u8 model) +{ +u32 brandidx; + +if (model <0x69 ) +return 0 ; + +if (model ==0xc1 || model ==0x6c || model ==0x7c ) +return 0 ; + +/* +* Differentiate between AM2 and ASB1. +* See "Constructing the processor Name String" in "Revision +* Guide for AMD NPT Family 0Fh Processors" (33610). +*/ + brandidx =cpuid_ebx (0x80000001 ); + brandidx = (brandidx >>9 ) &0x1f ; + +/* Single core */ +if ((model ==0x6f || model ==0x7f ) && + (brandidx ==0x7 || brandidx ==0x9 || brandidx ==0xc )) +return 0 ; + +/* Dual core */ +if (model ==0x6b && + (brandidx ==0xb || brandidx ==0xc )) +return 0 ; + +return 1 ; +} +static int __devinit k8temp_probe (struct pci_dev *pdev,const struct pci_device_id *id) {
@@ -179,9 +210,7 @@ static int __devinit k8temp_probe(struct pci_dev *pdev, "wrong - check erratum #141\n"); } -if ((model >=0x69 ) && - !(model ==0xc1 || model ==0x6c || model ==0x7c || - model ==0x6b || model ==0x6f || model ==0x7f )) { +if (is_rev_g_desktop (model)) {/* * RevG desktop CPUs (i.e. no socket S1G1 or * ASB1 parts) need additional offset,
Signature · 1 line
1.7.3.3
PATCH 30/260 xen: handle events as edge-triggered
In reply to Paul GortmakerFrom: Jeremy Fitzhardinge <[email protected]>
commit dffe2e1e1a1ddb566a76266136c312801c66dcf7 upstream.
Xen events are logically edge triggered, as Xen only calls the event upcall when an event is newly set, but not continuously as it remains set. As a result, use handle_edge_irq rather than handle_level_irq.
This has the important side-effect of fixing a long-standing bug of events getting lost if:
- an event's interrupt handler is running
- the event is migrated to a different vcpu
- the event is re-triggered
The most noticable symptom of these lost events is occasional lockups of blkfront.
Many thanks to Tom Kopec and Daniel Stodden in tracking this down.
--- drivers/xen/events.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/xen/events.c +1 -1
@@ -363,7 +363,7 @@ int bind_evtchn_to_irq(unsigned int evtchn) irq =find_unbound_irq ();set_irq_chip_and_handler_name (irq, &xen_dynamic_chip, - handle_level_irq,"event" ); + handle_edge_irq,"event" ); evtchn_to_irq[evtchn] = irq; irq_info[irq] =mk_evtchn_info (evtchn);
Signature · 1 line
1.7.3.3
PATCH 31/260 xen: use percpu interrupts for IPIs and VIRQs
In reply to Paul GortmakerFrom: Jeremy Fitzhardinge <[email protected]>
commit aaca49642b92c8a57d3ca5029a5a94019c7af69f upstream.
IPIs and VIRQs are inherently per-cpu event types, so treat them as such:
- use a specific percpu irq_chip implementation, and
- handle them with handle_percpu_irq
This makes the path for delivering these interrupts more efficient (no masking/unmasking, no locks), and it avoid problems with attempts to migrate them.
--- drivers/xen/events.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)
drivers/xen/events.c +15 -4
@@ -107,6 +107,7 @@ static inline unsigned long *cpu_evtchn_mask(int cpu)#define VALID_EVTCHN (chn) ((chn) != 0)static struct irq_chip xen_dynamic_chip; +static struct irq_chip xen_percpu_chip;/* Constructor for packed IRQ information. */ static struct irq_info mk_unbound_info (void )
@@ -389,8 +390,8 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)if (irq <0 ) goto out; -set_irq_chip_and_handler_name (irq, &xen_dynamic_chip, - handle_level_irq,"ipi" ); +set_irq_chip_and_handler_name (irq, &xen_percpu_chip, + handle_percpu_irq,"ipi" ); bind_ipi.vcpu = cpu; if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
@@ -430,8 +431,8 @@ static int bind_virq_to_irq(unsigned int virq, unsigned int cpu) irq =find_unbound_irq (); -set_irq_chip_and_handler_name (irq, &xen_dynamic_chip, - handle_level_irq,"virq" ); +set_irq_chip_and_handler_name (irq, &xen_percpu_chip, + handle_percpu_irq,"virq" ); evtchn_to_irq[evtchn] = irq; irq_info[irq] =mk_virq_info (evtchn, virq);
@@ -934,6 +935,16 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { .retrigger = retrigger_dynirq, }; +static struct irq_chip xen_percpu_chip__read_mostly = { + .name ="xen-percpu" , + + .disable = disable_dynirq, + .mask = disable_dynirq, + .unmask = enable_dynirq, + + .ack = ack_dynirq, +}; +void __init xen_init_IRQ (void ) {int i;
Signature · 1 line
1.7.3.3
PATCH 32/260 ALSA: hda - Rename iMic to Int Mic on Lenovo NB0763
In reply to Paul GortmakerFrom: David Henningsson <[email protected]>
commit 150b432f448281d5518f5229d240923f9a9c5459 upstream.
The non-standard name "iMic" makes PulseAudio ignore the microphone.
--- sound/pci/hda/patch_realtek.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
sound/pci/hda/patch_realtek.c +3 -3
@@ -6898,7 +6898,7 @@ static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { .num_items = 4, .items = { { "Mic", 0x0 }, - { "iMic", 0x1 }, + { "Int Mic", 0x1 }, { "Line", 0x2 }, { "CD", 0x4 }, },
@@ -8473,8 +8473,8 @@ static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {HDA_CODEC_MUTE ("CD Playback Switch" ,0x0b ,0x04 ,HDA_INPUT ),HDA_CODEC_VOLUME ("Mic Playback Volume" ,0x0b ,0x0 ,HDA_INPUT ),HDA_CODEC_MUTE ("Mic Playback Switch" ,0x0b ,0x0 ,HDA_INPUT ), -HDA_CODEC_VOLUME ("iMic Playback Volume" ,0x0b ,0x1 ,HDA_INPUT ), - HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), +HDA_CODEC_VOLUME ("Int Mic Playback Volume" ,0x0b ,0x1 ,HDA_INPUT ), + HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), { } /* end */ };
Signature · 1 line
1.7.3.3
PATCH 33/260 sata_mv: fix broken DSM/TRIM support (v2)
In reply to Paul GortmakerFrom: Mark Lord <[email protected]>
commit 44b733809a5aba7f6b15a548d31a56d25bf3851c upstream.
Fix DSM/TRIM commands in sata_mv (v2). These need to be issued using old-school "BM DMA", rather than via the EDMA host queue.
Since the chips don't have proper BM DMA status,
we need to be more careful with setting the ATA_DMA_INTR bit, since DSM/TRIM often has a long delay between "DMA complete" and "command complete".
GEN_I chips don't have BM DMA, so no TRIM for them.
--- drivers/ata/sata_mv.c | 44 +++++++++++++++++++++++++++++++++++++------- 1 files changed, 37 insertions(+), 7 deletions(-)
drivers/ata/sata_mv.c +37 -7
@@ -1886,19 +1886,25 @@ static void mv_bmdma_start(struct ata_queued_cmd *qc)* LOCKING: * Inherited from caller. */ -static void mv_bmdma_stop (struct ata_queued_cmd *qc) +static void mv_bmdma_stop_ap (struct ata_port *ap) { -struct ata_port *ap = qc->ap;void __iomem *port_mmio =mv_ap_base (ap);u32 cmd;/* clear start/stop bit */ cmd =readl (port_mmio +BMDMA_CMD ); - cmd &= ~ATA_DMA_START ; -writelfl (cmd, port_mmio +BMDMA_CMD ); +if (cmd &ATA_DMA_START ) { + cmd &= ~ATA_DMA_START ; +writelfl (cmd, port_mmio +BMDMA_CMD ); + +/* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ +ata_sff_dma_pause (ap); + } +} -/* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ -ata_sff_dma_pause (ap); +static void mv_bmdma_stop (struct ata_queued_cmd *qc) +{ +mv_bmdma_stop_ap (qc->ap); }/**
@@ -1922,8 +1928,21 @@ static u8 mv_bmdma_status(struct ata_port *ap) reg =readl (port_mmio +BMDMA_STATUS );if (reg &ATA_DMA_ACTIVE ) status =ATA_DMA_ACTIVE ; -else +else if (reg &ATA_DMA_ERR ) status = (reg &ATA_DMA_ERR ) |ATA_DMA_INTR ; +else { +/* +* Just because DMA_ACTIVE is 0 (DMA completed), +* this does _not_ mean the device is "done". +* So we should not yet be signalling ATA_DMA_INTR +* in some cases. Eg. DSM/TRIM, and perhaps others. +*/ +mv_bmdma_stop_ap (ap); +if (ioread8 (ap->ioaddr.altstatus_addr) &ATA_BUSY ) + status =0 ; +else + status =ATA_DMA_INTR ; + }return status; }
@@ -1983,6 +2002,9 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)switch (tf->protocol) {case ATA_PROT_DMA : +if (tf->command ==ATA_CMD_DSM ) +return ; +/* fall-thru */ case ATA_PROT_NCQ :break ;/* continue below */ case ATA_PROT_PIO :
@@ -2082,6 +2104,8 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc)if ((tf->protocol !=ATA_PROT_DMA ) && (tf->protocol !=ATA_PROT_NCQ ))return ; +if (tf->command ==ATA_CMD_DSM ) +return ;/* use bmdma for this */ /* Fill in Gen IIE command request block */ if (!(tf->flags &ATA_TFLAG_WRITE ))
@@ -2277,6 +2301,12 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)switch (qc->tf.protocol) {case ATA_PROT_DMA : +if (qc->tf.command ==ATA_CMD_DSM ) { +if (!ap->ops->bmdma_setup)/* no bmdma on GEN_I */ +return AC_ERR_OTHER ; +break ;/* use bmdma for this */ + } +/* fall thru */ case ATA_PROT_NCQ :mv_start_edma (ap, port_mmio, pp, qc->tf.protocol); pp->req_idx = (pp->req_idx +1 ) &MV_MAX_Q_DEPTH_MASK ;
Signature · 1 line
1.7.3.3
PATCH 34/260 x86, tsc, sched: Recompute cyc2ns_offset's during resume from sleep states
In reply to Paul GortmakerFrom: Suresh Siddha <[email protected]>
commit cd7240c0b900eb6d690ccee088a6c9b46dae815a upstream.
TSC's get reset after suspend/resume (even on cpu's with invariant TSC which runs at a constant rate across ACPI P-, C- and T-states). And in some systems BIOS seem to reinit TSC to arbitrary large value (still sync'd across cpu's) during resume.
This leads to a scenario of scheduler rq->clock (sched_clock_cpu()) less than rq->age_stamp (introduced in 2.6.32). This leads to a big value returned by scale_rt_power() and the resulting big group power set by the update_group_power() is causing improper load balancing between busy and idle cpu's after suspend/resume.
This resulted in multi-threaded workloads (like kernel-compilation) go slower after suspend/resume cycle on core i5 laptops.
Fix this by recomputing cyc2ns_offset's during resume, so that sched_clock() continues from the point where it was left off during suspend.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/tsc.h | 2 ++ arch/x86/kernel/tsc.c | 38 ++++++++++++++++++++++++++++++++++++++ arch/x86/power/cpu.c | 2 ++ 3 files changed, 42 insertions(+), 0 deletions(-)
arch/x86/include/asm/tsc.h +2 -0
@@ -59,5 +59,7 @@ extern void check_tsc_sync_source(int cpu);extern void check_tsc_sync_target (void );extern int notsc_setup (char *); +extern void save_sched_clock_state (void ); +extern void restore_sched_clock_state (void );#endif /* _ASM_X86_TSC_H */
arch/x86/kernel/tsc.c +38 -0
@@ -626,6 +626,44 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)local_irq_restore (flags); } +static unsigned long long cyc2ns_suspend; + +void save_sched_clock_state (void ) +{ +if (!sched_clock_stable) +return ; + + cyc2ns_suspend =sched_clock (); +} + +/* +* Even on processors with invariant TSC, TSC gets reset in some the +* ACPI system sleep states. And in some systems BIOS seem to reinit TSC to +* arbitrary value (still sync'd across cpu's) during resume from such sleep +* states. To cope up with this, recompute the cyc2ns_offset for each cpu so +* that sched_clock() continues from the point where it was left off during +* suspend. +*/ +void restore_sched_clock_state (void ) +{ +unsigned long long offset; +unsigned long flags; +int cpu; + +if (!sched_clock_stable) +return ; + +local_irq_save (flags); + +get_cpu_var (cyc2ns_offset) =0 ; + offset = cyc2ns_suspend -sched_clock (); + +for_each_possible_cpu (cpu) +per_cpu (cyc2ns_offset, cpu) = offset; + +local_irq_restore (flags); +} +#ifdef CONFIG_CPU_FREQ /* Frequency scaling support. Adjust the TSC based timer when the cpu frequency
arch/x86/power/cpu.c +2 -0
@@ -113,6 +113,7 @@ static void __save_processor_state(struct saved_context *ctxt)void save_processor_state (void ) {__save_processor_state (&saved_context); +save_sched_clock_state (); }#ifdef CONFIG_X86_32 EXPORT_SYMBOL (save_processor_state);
@@ -229,6 +230,7 @@ static void __restore_processor_state(struct saved_context *ctxt)void restore_processor_state (void ) {__restore_processor_state (&saved_context); +restore_sched_clock_state (); }#ifdef CONFIG_X86_32 EXPORT_SYMBOL (restore_processor_state);
Signature · 1 line
1.7.3.3
PATCH 35/260 PCI: MSI: Remove unsafe and unnecessary hardware access
In reply to Paul GortmakerFrom: Ben Hutchings <[email protected]>
commit fcd097f31a6ee207cc0c3da9cccd2a86d4334785 upstream.
During suspend on an SMP system, {read,write}_msi_msg_desc() may be called to mask and unmask interrupts on a device that is already in a reduced power state. At this point memory-mapped registers including MSI-X tables are not accessible, and config space may not be fully functional either.
While a device is in a reduced power state its interrupts are effectively masked and its MSI(-X) state will be restored when it is brought back to D0. Therefore these functions can simply read and write msi_desc::msg for devices not in D0.
Further, read_msi_msg_desc() should only ever be used to update a previously written message, so it can always read msi_desc::msg and never needs to touch the hardware.
--- drivers/pci/msi.c | 34 +++++++++++----------------------- 1 files changed, 11 insertions(+), 23 deletions(-)
drivers/pci/msi.c +11 -23
@@ -196,30 +196,15 @@ void unmask_msi_irq(unsigned int irq)void read_msi_msg_desc (struct irq_desc *desc,struct msi_msg *msg) {struct msi_desc *entry =get_irq_desc_msi (desc); -if (entry->msi_attrib.is_msix) { -void __iomem *base = entry->mask_base + - entry->msi_attrib.entry_nr *PCI_MSIX_ENTRY_SIZE ; - msg->address_lo =readl (base +PCI_MSIX_ENTRY_LOWER_ADDR ); - msg->address_hi =readl (base +PCI_MSIX_ENTRY_UPPER_ADDR ); - msg->data =readl (base +PCI_MSIX_ENTRY_DATA ); - }else { -struct pci_dev *dev = entry->dev; -int pos = entry->msi_attrib.pos; -u16 data; +/* We do not touch the hardware (which may not even be +* accessible at the moment) but return the last message +* written. Assert that this is valid, assuming that +* valid messages are not all-zeroes. */ +BUG_ON (!(entry->msg.address_hi | entry->msg.address_lo | + entry->msg.data)); -pci_read_config_dword (dev,msi_lower_address_reg (pos), - &msg->address_lo); -if (entry->msi_attrib.is_64) { -pci_read_config_dword (dev,msi_upper_address_reg (pos), - &msg->address_hi); -pci_read_config_word (dev,msi_data_reg (pos,1 ), &data); - }else { - msg->address_hi =0 ; -pci_read_config_word (dev,msi_data_reg (pos,0 ), &data); - } - msg->data = data; - } + *msg = entry->msg; }void read_msi_msg (unsigned int irq,struct msi_msg *msg)
@@ -232,7 +217,10 @@ void read_msi_msg(unsigned int irq, struct msi_msg *msg)void write_msi_msg_desc (struct irq_desc *desc,struct msi_msg *msg) {struct msi_desc *entry =get_irq_desc_msi (desc); -if (entry->msi_attrib.is_msix) { + +if (entry->dev->current_state !=PCI_D0 ) { +/* Don't touch the hardware now */ + }else if (entry->msi_attrib.is_msix) {void __iomem *base; base = entry->mask_base + entry->msi_attrib.entry_nr *PCI_MSIX_ENTRY_SIZE ;
Signature · 1 line
1.7.3.3
PATCH 36/260 PCI: MSI: Restore read_msi_msg_desc(); add get_cached_msi_msg_desc()
In reply to Paul GortmakerFrom: Ben Hutchings <[email protected]>
commit 30da55242818a8ca08583188ebcbaccd283ad4d9 upstream.
commit 2ca1af9aa3285c6a5f103ed31ad09f7399fc65d7 "PCI: MSI: Remove unsafe and unnecessary hardware access" changed read_msi_msg_desc() to return the last MSI message written instead of reading it from the device, since it may be called while the device is in a reduced power state.
However, the pSeries platform code really does need to read messages from the device, since they are initially written by firmware. Therefore:
- Restore the previous behaviour of read_msi_msg_desc()
- Add new functions get_cached_msi_msg{,_desc}() which return the last MSI message written
- Use the new functions where appropriate
--- arch/ia64/kernel/msi_ia64.c | 2 +- arch/ia64/sn/kernel/msi_sn.c | 2 +- arch/x86/kernel/apic/io_apic.c | 2 +- drivers/pci/msi.c | 47 +++++++++++++++++++++++++++++++++++---- include/linux/msi.h | 2 + 5 files changed, 47 insertions(+), 8 deletions(-)
arch/ia64/kernel/msi_ia64.c +1 -1
@@ -25,7 +25,7 @@ static int ia64_set_msi_irq_affinity(unsigned int irq,if (irq_prepare_move (irq, cpu))return -1 ; -read_msi_msg (irq, &msg); +get_cached_msi_msg (irq, &msg); addr = msg.address_lo; addr &=MSI_ADDR_DEST_ID_MASK ;
arch/ia64/sn/kernel/msi_sn.c +1 -1
@@ -175,7 +175,7 @@ static int sn_set_msi_irq_affinity(unsigned int irq,* Release XIO resources for the old MSI PCI address */ -read_msi_msg (irq, &msg); +get_cached_msi_msg (irq, &msg); sn_pdev = (struct pcidev_info *)sn_irq_info->irq_pciioinfo; pdev = sn_pdev->pdi_linux_pcidev; provider =SN_PCIDEV_BUSPROVIDER (pdev);
arch/x86/kernel/apic/io_apic.c +1 -1
@@ -3415,7 +3415,7 @@ static int set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask) cfg = desc->chip_data; -read_msi_msg_desc (desc, &msg); +get_cached_msi_msg_desc (desc, &msg); msg.data &= ~MSI_DATA_VECTOR_MASK ; msg.data |=MSI_DATA_VECTOR (cfg->vector);
drivers/pci/msi.c +42 -5
62 lines not on this page · raw message
include/linux/msi.h +2 -0
@@ -14,8 +14,10 @@ struct irq_desc;extern void mask_msi_irq (unsigned int irq);extern void unmask_msi_irq (unsigned int irq);extern void read_msi_msg_desc (struct irq_desc *desc,struct msi_msg *msg); +extern void get_cached_msi_msg_desc (struct irq_desc *desc,struct msi_msg *msg);extern void write_msi_msg_desc (struct irq_desc *desc,struct msi_msg *msg);extern void read_msi_msg (unsigned int irq,struct msi_msg *msg); +extern void get_cached_msi_msg (unsigned int irq,struct msi_msg *msg);extern void write_msi_msg (unsigned int irq,struct msi_msg *msg);struct msi_desc {
Signature · 1 line
1.7.3.3
PATCH 37/260 staging: hv: Fix missing functions for net_device_ops
In reply to Paul GortmakerFrom: Haiyang Zhang <[email protected]>
commit b681b5886bb5d1f5b6750a0ed7c62846da7ccea4 upstream.
Fix missing functions for net_device_ops.
It's a bug when porting the drivers from 2.6.27 to 2.6.32. In 2.6.27, the default functions for Ethernet, like eth_change_mtu(), were assigned by ether_setup(). But in 2.6.32, these function pointers moved to net_device_ops structure and no longer be assigned in ether_setup(). So we need to set these functions in our driver code. It will ensure the MTU won't be set beyond 1500. Otherwise, this can cause an error on the server side, because the HyperV linux driver doesn't support jumbo frame yet.
--- drivers/staging/hv/netvsc_drv.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/staging/hv/netvsc_drv.c +3 -0
@@ -382,6 +382,9 @@ static const struct net_device_ops device_ops = { .ndo_start_xmit = netvsc_start_xmit, .ndo_get_stats = netvsc_get_stats, .ndo_set_multicast_list = netvsc_set_multicast_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = eth_mac_addr, };static int netvsc_probe (struct device *device)
Signature · 1 line
1.7.3.3
PATCH 38/260 staging: hv: Fixed bounce kmap problem by using correct index
In reply to Paul GortmakerFrom: Hank Janssen <[email protected]>
commit 0c47a70a9a8a6d1ec37a53d2f9cb82f8b8ef8aa2 upstream.
Fixed bounce offset kmap problem by using correct index.
The symptom of the problem is that in some NAS appliances this problem represents Itself by a unresponsive VM under a load with many clients writing small files.
--- drivers/staging/hv/storvsc_drv.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/hv/storvsc_drv.c +2 -2
@@ -524,7 +524,7 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl,ASSERT (orig_sgl[i].offset + orig_sgl[i].length <=PAGE_SIZE ); -if (j ==0 ) +if (bounce_addr ==0 ) bounce_addr = (unsigned long )kmap_atomic (sg_page ((&bounce_sgl[j])),KM_IRQ0 );while (srclen) {
@@ -585,7 +585,7 @@ static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl, destlen = orig_sgl[i].length;ASSERT (orig_sgl[i].offset + orig_sgl[i].length <=PAGE_SIZE ); -if (j ==0 ) +if (bounce_addr ==0 ) bounce_addr = (unsigned long )kmap_atomic (sg_page ((&bounce_sgl[j])),KM_IRQ0 );while (destlen) {
Signature · 1 line
1.7.3.3
PATCH 39/260 staging: hv: Fixed the value of the 64bit-hole inside ring buffer
In reply to Paul GortmakerFrom: Haiyang Zhang <[email protected]>
commit e5fa721d1c2a54261a37eb59686e18dee34b6af6 upstream.
Fixed the value of the 64bit-hole inside ring buffer, this caused a problem on Hyper-V when running checked Windows builds.
Checked builds of Windows are used internally and given to external system integrators at times. They are builds that for example that all elements in a structure follow the definition of that Structure. The bug this fixed was for a field that we did not fill in at all (Because we do Not use it on the Linux side), and the checked build of windows gives errors on it internally to the Windows logs.
This fixes that error.
--- drivers/staging/hv/RingBuffer.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/staging/hv/RingBuffer.c +1 -2
@@ -192,8 +192,7 @@ Description:static inline u64 GetRingBufferIndices (RING_BUFFER_INFO *RingInfo) { -return ((u64 )RingInfo->RingBuffer->WriteIndex <<32 ) - || RingInfo->RingBuffer->ReadIndex; +return (u64 )RingInfo->RingBuffer->WriteIndex <<32 ; }
Signature · 1 line
1.7.3.3
PATCH 40/260 staging: hv: Increased storvsc ringbuffer and max_io_requests
In reply to Paul GortmakerFrom: Hank Janssen <[email protected]>
commit 15dd1c9f53b31cdc84b8072a88c23fa09527c596 upstream.
Increased storvsc ringbuffer and max_io_requests. This now more closely mimics the numbers on Hyper-V. And will allow more IO requests to take place for the SCSI driver.
Max_IO is set to double from what it was before, Hyper-V allows it and we have had appliance builder requests to see if it was a problem to increase the number.
Ringbuffer size for storvsc is now increased because I have seen A few buffer problems on extremely busy systems. They were Set pretty low before. And since max_io_requests is increased I Really needed to increase the buffer as well.
--- drivers/staging/hv/StorVscApi.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/hv/StorVscApi.h +2 -2
@@ -28,10 +28,10 @@#include "VmbusApi.h" /* Defines */ -#define STORVSC_RING_BUFFER_SIZE (10*PAGE_SIZE) +#define STORVSC_RING_BUFFER_SIZE (20*PAGE_SIZE)#define BLKVSC_RING_BUFFER_SIZE (20*PAGE_SIZE) -#define STORVSC_MAX_IO_REQUESTS 64 +#define STORVSC_MAX_IO_REQUESTS 128/* * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In
Signature · 1 line
1.7.3.3
PATCH 41/260 staging: hv: Fixed lockup problem with bounce_buffer scatter list
In reply to Paul GortmakerFrom: Hank Janssen <[email protected]>
commit 77c5ceaff31645ea049c6706b99e699eae81fb88 upstream.
Fixed lockup problem with bounce_buffer scatter list which caused crashes in heavy loads. And minor code indentation cleanup in effected area.
Removed whitespace and noted minor indentation changes in description as pointed out by Joe Perches. (Thanks for reviewing Joe)
--- drivers/staging/hv/storvsc_drv.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/staging/hv/storvsc_drv.c +4 -1
@@ -644,6 +644,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd,unsigned int request_size =0 ;int i;struct scatterlist *sgl; +unsigned int sg_count =0 ;DPRINT_ENTER (STORVSC_DRV );
@@ -728,6 +729,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, request->DataBuffer.Length =scsi_bufflen (scmnd);if (scsi_sg_count (scmnd)) { sgl = (struct scatterlist *)scsi_sglist (scmnd); + sg_count =scsi_sg_count (scmnd);/* check if we need to bounce the sgl */ if (do_bounce_buffer (sgl,scsi_sg_count (scmnd)) !=-1 ) {
@@ -762,11 +764,12 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, scsi_sg_count(scmnd)); sgl = cmd_request->bounce_sgl; + sg_count = cmd_request->bounce_sgl_count; } request->DataBuffer.Offset = sgl[0 ].offset; -for (i =0 ; i <scsi_sg_count (scmnd); i++) { +for (i =0 ; i < sg_count; i++) {DPRINT_DBG (STORVSC_DRV ,"sgl[%d] len %d offset %d \n" , i, sgl[i].length, sgl[i].offset); request->DataBuffer.PfnArray[i] =
Signature · 1 line
1.7.3.3
PATCH 42/260 fuse: flush background queue on connection close
In reply to Paul GortmakerFrom: Miklos Szeredi <[email protected]>
commit 595afaf9e6ee1b48e13ec4b8bcc8c7dee888161a upstream.
David Bartly reported that fuse can hang in fuse_get_req_nofail() when the connection to the filesystem server is no longer active.
If bg_queue is not empty then flush_bg_queue() called from request_end() can put more requests on to the pending queue. If this happens while ending requests on the processing queue then those background requests will be queued to the pending list and never ended.
Another problem is that fuse_dev_release() didn't wake up processes sleeping on blocked_waitq.
Solve this by:
a) flushing the background queue before calling end_requests() on the pending and processing queues
b) setting blocked = 0 and waking up processes waiting on blocked_waitq()
Thanks to David for an excellent bug report.
--- fs/fuse/dev.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)
fs/fuse/dev.c +12 -4
@@ -1158,6 +1158,14 @@ __acquires(&fc->lock) } } +static void end_queued_requests (struct fuse_conn *fc) +{ + fc->max_background =UINT_MAX ; +flush_bg_queue (fc); +end_requests (fc, &fc->pending); +end_requests (fc, &fc->processing); +} +/* * Abort all requests. *
@@ -1184,8 +1192,7 @@ void fuse_abort_conn(struct fuse_conn *fc) fc->connected =0 ; fc->blocked =0 ;end_io_requests (fc); -end_requests (fc, &fc->pending); -end_requests (fc, &fc->processing); +end_queued_requests (fc);wake_up_all (&fc->waitq);wake_up_all (&fc->blocked_waitq);kill_fasync (&fc->fasync,SIGIO ,POLL_IN );
@@ -1200,8 +1207,9 @@ int fuse_dev_release(struct inode *inode, struct file *file)if (fc) {spin_lock (&fc->lock); fc->connected =0 ; -end_requests (fc, &fc->pending); -end_requests (fc, &fc->processing); + fc->blocked =0 ; +end_queued_requests (fc); +wake_up_all (&fc->blocked_waitq);spin_unlock (&fc->lock);fuse_conn_put (fc); }
Signature · 1 line
1.7.3.3
PATCH 43/260 ath9k_hw: fix parsing of HT40 5 GHz CTLs
In reply to Paul GortmakerFrom: Luis R. Rodriguez <[email protected]>
commit 904879748d7439a6dabdc6be9aad983e216b027d upstream.
The 5 GHz CTL indexes were not being read for all hardware devices due to the masking out through the CTL_MODE_M mask being one bit too short. Without this the calibrated regulatory maximum values were not being picked up when devices operate on 5 GHz in HT40 mode. The final output power used for Atheros devices is the minimum between the calibrated CTL values and what CRDA provides.
--- drivers/net/wireless/ath/ath9k/eeprom.h | 2 +- drivers/net/wireless/ath/regd.h | 1 - 2 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/eeprom.h +1 -1
@@ -61,7 +61,7 @@#define SD_NO_CTL 0xE0#define NO_CTL 0xff -#define CTL_MODE_M 7 +#define CTL_MODE_M 0xf#define CTL_11A 0#define CTL_11B 1#define CTL_11G 2
drivers/net/wireless/ath/regd.h +0 -1
@@ -31,7 +31,6 @@ enum ctl_group {#define NO_CTL 0xff#define SD_NO_CTL 0xE0#define NO_CTL 0xff -#define CTL_MODE_M 7#define CTL_11A 0#define CTL_11B 1#define CTL_11G 2
Signature · 1 line
1.7.3.3
PATCH 44/260 ocfs2: Fix incorrect checksum validation error
In reply to Paul GortmakerFrom: Sunil Mushran <[email protected]>
commit f5ce5a08a40f2086435858ddc80cb40394b082eb upstream.
For local mounts, ocfs2_read_locked_inode() calls ocfs2_read_blocks_sync() to read the inode off the disk. The latter first checks to see if that block is cached in the journal, and, if so, returns that block. That is ok.
But ocfs2_read_locked_inode() goes wrong when it tries to validate the checksum of such blocks. Blocks that are cached in the journal may not have had their checksum computed as yet. We should not validate the checksums of such blocks.
Fixes ossbz#1282
http://oss.oracle.com/bugzilla/show_bug.cgi?id=1282
--- fs/ocfs2/inode.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
fs/ocfs2/inode.c +5 -1
@@ -484,7 +484,11 @@ static int ocfs2_read_locked_inode(struct inode *inode, OCFS2_BH_IGNORE_CACHE); }else { status =ocfs2_read_blocks_sync (osb, args->fi_blkno,1 , &bh); -if (!status) +/* +* If buffer is in jbd, then its checksum may not have been +* computed as yet. +*/ +if (!status && !buffer_jbd (bh)) status =ocfs2_validate_inode_block (osb->sb, bh); }if (status <0 ) {
Signature · 1 line
1.7.3.3
PATCH 45/260 USB: ehci-ppc-of: problems in unwind
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
commit 08a3b3b1c2e622e378d9086aee9e2e42ce37591d upstream.
The iounmap(ehci->ohci_hcctrl_reg); should be the first thing we do because the ioremap() was the last thing we did. Also if we hit any of the goto statements in the original code then it would have led to a NULL dereference of "ehci". This bug was introduced in: 796bcae7361c "USB: powerpc: Workaround for the PPC440EPX USBH_23 errata [take 3]"
I modified the few lines in front a little so that my code didn't obscure the return success code path.
--- drivers/usb/host/ehci-ppc-of.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
drivers/usb/host/ehci-ppc-of.c +7 -5
@@ -192,17 +192,19 @@ ehci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match) } rv =usb_add_hcd (hcd, irq,0 ); -if (rv ==0 ) -return 0 ; +if (rv) + goto err_ehci; + +return 0 ; +err_ehci: +if (ehci->has_amcc_usb23) +iounmap (ehci->ohci_hcctrl_reg);iounmap (hcd->regs); err_ioremap:irq_dispose_mapping (irq); err_irq:release_mem_region (hcd->rsrc_start, hcd->rsrc_len); - -if (ehci->has_amcc_usb23) -iounmap (ehci->ohci_hcctrl_reg); err_rmr:usb_put_hcd (hcd);
Signature · 1 line
1.7.3.3
PATCH 46/260 USB: Fix kernel oops with g_ether and Windows
In reply to Paul GortmakerFrom: Maxim Osipov <[email protected]>
commit 037d3656adbd7e8cb848f01cf5dec423ed76bbe7 upstream.
Please find attached patch for
https://bugzilla.kernel.org/show_bug.cgi?id=16023 problem.
--- drivers/usb/gadget/rndis.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
drivers/usb/gadget/rndis.c +7 -3
@@ -292,9 +292,13 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,/* mandatory */ case OID_GEN_VENDOR_DESCRIPTION :pr_debug ("%s: OID_GEN_VENDOR_DESCRIPTION\n" , __func__); - length =strlen (rndis_per_dev_params [configNr].vendorDescr); -memcpy (outbuf, - rndis_per_dev_params [configNr].vendorDescr, length); +if ( rndis_per_dev_params [configNr].vendorDescr ) { + length =strlen (rndis_per_dev_params [configNr].vendorDescr); +memcpy (outbuf, + rndis_per_dev_params [configNr].vendorDescr, length); + }else { + outbuf[0 ] =0 ; + } retval =0 ;break ;
Signature · 1 line
1.7.3.3
PATCH 47/260 USB: CP210x Add new device ID
In reply to Paul GortmakerFrom: Craig Shelley <[email protected]>
commit 541e05ec3add5ab5bcf238d60161b53480280b20 upstream.
New device ID added for Balluff RFID reader.
--- drivers/usb/serial/cp210x.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/usb/serial/cp210x.c +5 -4
@@ -111,6 +111,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ + { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */
@@ -124,14 +125,14 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ - { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ - { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ - { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ - { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ { USB_DEVICE(0x16DC, 0x0012) }, /* W-IE-NE-R Plein & Baus GmbH MPOD Multi Channel Power Supply */ { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */ + { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ + { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ + { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ + { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ { } /* Terminating Entry */ };
Signature · 1 line
1.7.3.3
PATCH 48/260 USB: cp210x: Add B&G H3000 link cable ID
In reply to Paul GortmakerFrom: Jason Detring <[email protected]>
commit 0bf7a81c5d447c21db434be35363c44c0a30f598 upstream.
This is the cable between an H3000 navigation unit and a multi-function display.
http://www.bandg.com/en/Products/H3000/Spares-and-Accessories/Cables/H3000-CPU-USB-Cable-Pack/
--- drivers/usb/serial/cp210x.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/serial/cp210x.c +1 -0
@@ -90,6 +90,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */ { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ + { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */
Signature · 1 line
1.7.3.3
PATCH 49/260 USB: ftdi_sio: Added custom PIDs for ChamSys products
In reply to Paul GortmakerFrom: Luke Lowrey <[email protected]>
commit 657373883417b2618023fd4135d251ba06a2c30a upstream.
Added the 0xDAF8 to 0xDAFF PID range for ChamSys limited USB interface/wing products
--- drivers/usb/serial/ftdi_sio.c | 8 ++++++++ drivers/usb/serial/ftdi_sio_ids.h | 12 ++++++++++++ 2 files changed, 20 insertions(+), 0 deletions(-)
drivers/usb/serial/ftdi_sio.c +8 -0
@@ -759,6 +759,14 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) }, { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_PC_WING_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_USB_DMX_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MIDI_TIMECODE_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MINI_WING_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) }, { }, /* Optional parameter entry */ { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +12 -0
@@ -135,6 +135,18 @@#define FTDI_NDI_AURORA_SCU_PID 0xDA74/* NDI Aurora SCU */ /* +* ChamSys Limited (www.chamsys.co.uk) USB wing/interface product IDs +*/ +#define FTDI_CHAMSYS_24_MASTER_WING_PID 0xDAF8 +#define FTDI_CHAMSYS_PC_WING_PID 0xDAF9 +#define FTDI_CHAMSYS_USB_DMX_PID 0xDAFA +#define FTDI_CHAMSYS_MIDI_TIMECODE_PID 0xDAFB +#define FTDI_CHAMSYS_MINI_WING_PID 0xDAFC +#define FTDI_CHAMSYS_MAXI_WING_PID 0xDAFD +#define FTDI_CHAMSYS_MEDIA_WING_PID 0xDAFE +#define FTDI_CHAMSYS_WING_PID 0xDAFF + +/* * Westrex International devices submitted by Cory Lee */ #define FTDI_WESTREX_MODEL_777_PID 0xDC00/* Model 777 */
Signature · 1 line
1.7.3.3
PATCH 50/260 usb: serial: mos7840: Add USB ID to support the B&B Electronics USOPTL4-2P.
In reply to Paul GortmakerFrom: Dave Ludlow <[email protected]>
commit caf3a636a9f809fdca5fa746e6687096457accb1 upstream.
Add the USB ID needed to support B&B Electronic's 2-port, optically-isolated, powered, USB to RS485 converter.
--- drivers/usb/serial/mos7840.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/usb/serial/mos7840.c +3 -0
@@ -130,6 +130,7 @@#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44#define BANDB_DEVICE_ID_USOPTL2_4 0xAC24 +#define BANDB_DEVICE_ID_USOPTL4_2P 0xBC02/* This driver also supports * ATEN UC2324 device using Moschip MCS7840
@@ -193,6 +194,7 @@ static const struct usb_device_id moschip_port_id_table[] = { {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4P)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)}, {} /* terminating entry */
@@ -210,6 +212,7 @@ static const struct usb_device_id moschip_id_table_combined[] __devinitconst = { {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4P)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)}, {} /* terminating entry */
Signature · 1 line
1.7.3.3
PATCH 51/260 usb: serial: mos7840: Add USB IDs to support more B&B USB/RS485 converters.
In reply to Paul GortmakerFrom: Dave Ludlow <[email protected]>
commit 870408c8291015872a7a0b583673a9e56b3e73f4 upstream.
Add the USB IDs needed to support the B&B USOPTL4-4P, USO9ML2-2P, and USO9ML2-4P. This patch expands and corrects a typo in the patch sent on 08-31-2010.
--- drivers/usb/serial/mos7840.c | 35 ++++++++++++++++++++++------------- 1 files changed, 22 insertions(+), 13 deletions(-)
drivers/usb/serial/mos7840.c +22 -13
@@ -120,17 +120,20 @@* by making a change here, in moschip_port_id_table, and in * moschip_id_table_combined */ -#define USB_VENDOR_ID_BANDB 0x0856 -#define BANDB_DEVICE_ID_USO9ML2_2 0xAC22 -#define BANDB_DEVICE_ID_USO9ML2_4 0xAC24 -#define BANDB_DEVICE_ID_US9ML2_2 0xAC29 -#define BANDB_DEVICE_ID_US9ML2_4 0xAC30 -#define BANDB_DEVICE_ID_USPTL4_2 0xAC31 -#define BANDB_DEVICE_ID_USPTL4_4 0xAC32 -#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42 -#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 -#define BANDB_DEVICE_ID_USOPTL2_4 0xAC24 -#define BANDB_DEVICE_ID_USOPTL4_2P 0xBC02 +#define USB_VENDOR_ID_BANDB 0x0856 +#define BANDB_DEVICE_ID_USO9ML2_2 0xAC22 +#define BANDB_DEVICE_ID_USO9ML2_2P 0xBC00 +#define BANDB_DEVICE_ID_USO9ML2_4 0xAC24 +#define BANDB_DEVICE_ID_USO9ML2_4P 0xBC01 +#define BANDB_DEVICE_ID_US9ML2_2 0xAC29 +#define BANDB_DEVICE_ID_US9ML2_4 0xAC30 +#define BANDB_DEVICE_ID_USPTL4_2 0xAC31 +#define BANDB_DEVICE_ID_USPTL4_4 0xAC32 +#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42 +#define BANDB_DEVICE_ID_USOPTL4_2P 0xBC02 +#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 +#define BANDB_DEVICE_ID_USOPTL4_4P 0xBC03 +#define BANDB_DEVICE_ID_USOPTL2_4 0xAC24/* This driver also supports * ATEN UC2324 device using Moschip MCS7840
@@ -186,15 +189,18 @@ static const struct usb_device_id moschip_port_id_table[] = { {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4P)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_2)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_4)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_2)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)}, - {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4P)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)}, {} /* terminating entry */
@@ -204,15 +210,18 @@ static const struct usb_device_id moschip_id_table_combined[] __devinitconst = { {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4P)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_2)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_4)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_2)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, + {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P)}, {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)}, - {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4P)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)}, {} /* terminating entry */
Signature · 1 line
1.7.3.3
PATCH 52/260 USB: Expose vendor-specific ACM channel on Nokia 5230
In reply to Paul GortmakerFrom: Przemo Firszt <[email protected]>
commit 83a4eae9aeed4a69e89e323a105e653ae06e7c1f upstream.
Nokia S60 phones expose two ACM channels. The first is a modem, the second is 'vendor-specific' but is treated as a serial device at the S60 end, so we want to expose it on Linux too.
--- drivers/usb/class/cdc-acm.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/class/cdc-acm.c +1 -0
@@ -1596,6 +1596,7 @@ static const struct usb_device_id acm_ids[] = { { NOKIA_PCSUITE_ACM_INFO(0x00e9), }, /* Nokia 5320 XpressMusic */ { NOKIA_PCSUITE_ACM_INFO(0x0108), }, /* Nokia 5320 XpressMusic 2G */ { NOKIA_PCSUITE_ACM_INFO(0x01f5), }, /* Nokia N97, RM-505 */ + { NOKIA_PCSUITE_ACM_INFO(0x02e3), }, /* Nokia 5230, RM-588 *//* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */
Signature · 1 line
1.7.3.3
PATCH 53/260 USB: cdc-acm: Adding second ACM channel support for various Nokia and one Samsung phones
In reply to Paul GortmakerFrom: Toby Gray <[email protected]>
commit 4035e45632c2a8bb4edae83c20447051bd9a9604 upstream.
S60 phones from Nokia and Samsung expose two ACM channels. The first is a modem with a standard AT-command interface, which is picked up correctly by CDC-ACM.
The second ACM port is marked as having a vendor-specific protocol. This means that the ACM driver will not claim the second channel by default.
This adds support for the second ACM channel for the following devices:
Nokia E63
Nokia E75
Nokia 6760 Slide
Nokia E52
Nokia E55
Nokia E72
Nokia X6
Nokia N97 Mini
Nokia 5800 Xpressmusic
Nokia E90
Samsung GTi8510 (INNOV8)
--- drivers/usb/class/cdc-acm.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
drivers/usb/class/cdc-acm.c +16 -0
@@ -1487,6 +1487,11 @@ static int acm_reset_resume(struct usb_interface *intf) USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, \ USB_CDC_ACM_PROTO_VENDOR) +#define SAMSUNG_PCSUITE_ACM_INFO (x) \ + USB_DEVICE_AND_INTERFACE_INFO(0x04e7, x, \ + USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, \ + USB_CDC_ACM_PROTO_VENDOR) +/* * USB driver structure. */
@@ -1597,6 +1602,17 @@ static const struct usb_device_id acm_ids[] = { { NOKIA_PCSUITE_ACM_INFO(0x0108), }, /* Nokia 5320 XpressMusic 2G */ { NOKIA_PCSUITE_ACM_INFO(0x01f5), }, /* Nokia N97, RM-505 */ { NOKIA_PCSUITE_ACM_INFO(0x02e3), }, /* Nokia 5230, RM-588 */ + { NOKIA_PCSUITE_ACM_INFO(0x0178), }, /* Nokia E63 */ + { NOKIA_PCSUITE_ACM_INFO(0x010e), }, /* Nokia E75 */ + { NOKIA_PCSUITE_ACM_INFO(0x02d9), }, /* Nokia 6760 Slide */ + { NOKIA_PCSUITE_ACM_INFO(0x01d0), }, /* Nokia E52 */ + { NOKIA_PCSUITE_ACM_INFO(0x0223), }, /* Nokia E72 */ + { NOKIA_PCSUITE_ACM_INFO(0x0275), }, /* Nokia X6 */ + { NOKIA_PCSUITE_ACM_INFO(0x026c), }, /* Nokia N97 Mini */ + { NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */ + { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ + { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ + { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) *//* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */
Signature · 1 line
1.7.3.3
PATCH 54/260 USB: cdc-acm: Add pseudo modem without AT command capabilities
In reply to Paul GortmakerFrom: Philippe Corbes <[email protected]>
commit 5b239f0aebd4dd6f85b13decf5e18e86e35d57f0 upstream.
cdc-acm.c : Manage pseudo-modem without AT commands capabilities
Enable to drive electronic simple gadgets based on microcontrolers. The Interface descriptor is like this:
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 0 None--- drivers/usb/class/cdc-acm.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/class/cdc-acm.c +4 -0
@@ -1621,6 +1621,10 @@ static const struct usb_device_id acm_ids[] = { .driver_info = NOT_A_MODEM, }, +/* control interfaces without any protocol set */ + {USB_INTERFACE_INFO (USB_CLASS_COMM ,USB_CDC_SUBCLASS_ACM , + USB_CDC_PROTO_NONE) }, +/* control interfaces with various AT-command sets */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, USB_CDC_ACM_PROTO_AT_V25TER) },
Signature · 1 line
1.7.3.3
PATCH 55/260 USB: cdc-acm: Fixing crash when ACM probing interfaces with no endpoint descriptors.
In reply to Paul GortmakerFrom: Toby Gray <[email protected]>
commit 577045c0a76e34294f902a7d5d60e90b04d094d0 upstream.
Certain USB devices, such as the Nokia X6 mobile phone, don't expose any endpoint descriptors on some of their interfaces. If the ACM driver is forced to probe all interfaces on a device the a NULL pointer dereference will occur when the ACM driver attempts to use the endpoint of the alternative settings. One way to get the ACM driver to probe all the interfaces is by using the /sys/bus/usb/drivers/cdc_acm/new_id interface.
This patch checks that the endpoint pointer for the current alternate settings is non-NULL before using it.
--- drivers/usb/class/cdc-acm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/usb/class/cdc-acm.c +2 -1
@@ -971,7 +971,8 @@ static int acm_probe(struct usb_interface *intf, }if (!buflen) { -if (intf->cur_altsetting->endpoint->extralen && +if (intf->cur_altsetting->endpoint && + intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) {dev_dbg (&intf->dev,"Seeking extra descriptors on endpoint\n" );
Signature · 1 line
1.7.3.3
PATCH 56/260 ALSA: seq/oss - Fix double-free at error path of snd_seq_oss_open()
In reply to Paul GortmakerFrom: Takashi Iwai <[email protected]>
commit 27f7ad53829f79e799a253285318bff79ece15bd upstream.
The error handling in snd_seq_oss_open() has several bad codes that do dereferecing released pointers and double-free of kmalloc'ed data. The object dp is release in free_devinfo() that is called via private_free callback. The rest shouldn't touch this object any more.
The patch changes delete_port() to call kfree() in any case, and gets rid of unnecessary calls of destructors in snd_seq_oss_open().
Fixes CVE-2010-3080.
--- sound/core/seq/oss/seq_oss_init.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
sound/core/seq/oss/seq_oss_init.c +4 -5
@@ -281,13 +281,10 @@ snd_seq_oss_open(struct file *file, int level)return 0 ; _error: -snd_seq_oss_writeq_delete (dp->writeq); -snd_seq_oss_readq_delete (dp->readq);snd_seq_oss_synth_cleanup (dp);snd_seq_oss_midi_cleanup (dp); -delete_port (dp);delete_seq_queue (dp->queue); -kfree (dp); +delete_port (dp);return rc; }
@@ -350,8 +347,10 @@ create_port(struct seq_oss_devinfo *dp)static int delete_port (struct seq_oss_devinfo *dp) { -if (dp->port <0 ) +if (dp->port <0 ) { +kfree (dp);return 0 ; + }debug_printk (("delete_port %i\n" , dp->port));return snd_seq_event_port_detach (dp->cseq, dp->port);
Signature · 1 line
1.7.3.3
PATCH 57/260 sysfs: checking for NULL instead of ERR_PTR
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
commit 57f9bdac2510cd7fda58e4a111d250861eb1ebeb upstream.
d_path() returns an ERR_PTR and it doesn't return NULL.
--- fs/sysfs/file.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/sysfs/file.c +1 -1
@@ -340,7 +340,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)char *p; p =d_path (&file->f_path, last_sysfs_file,sizeof (last_sysfs_file)); -if (p) +if (!IS_ERR (p))memmove (last_sysfs_file, p,strlen (p) +1 );/* need attr_sd for attr and ops, its parent for kobj */
Signature · 1 line
1.7.3.3
PATCH 58/260 oprofile: fix crash when accessing freed task structs
In reply to Paul GortmakerFrom: Robert Richter <[email protected]>
commit 750d857c682f4db60d14722d430c7ccc35070962 upstream.
This patch fixes a crash during shutdown reported below. The crash is caused by accessing already freed task structs. The fix changes the order for registering and unregistering notifier callbacks.
All notifiers must be initialized before buffers start working. To stop buffer synchronization we cancel all workqueues, unregister the notifier callback and then flush all buffers. After all of this we finally can free all tasks listed.
This should avoid accessing freed tasks.
Quoted 18 lines · Benjamin Herrenschmidt
So the initial observation is a spinlock bad magic followed by a crash in the spinlock debug code:
[ 1541.586531] BUG: spinlock bad magic on CPU#5, events/5/136 [ 1541.597564] Unable to handle kernel paging request for data at address 0x6b6b6b6b6b6b6d03Backtrace looks like:
spin_bug+0x74/0xd4 ._raw_spin_lock+0x48/0x184 ._spin_lock+0x10/0x24 .get_task_mm+0x28/0x8c .sync_buffer+0x1b4/0x598 .wq_sync_buffer+0xa0/0xdc .worker_thread+0x1d8/0x2a8 .kthread+0xa8/0xb4 .kernel_thread+0x54/0x70
Quoted 2 lines
So we are accessing a freed task struct in the work queue when processing the samples.
--- drivers/oprofile/buffer_sync.c | 27 ++++++++++++++------------- drivers/oprofile/cpu_buffer.c | 2 -- 2 files changed, 14 insertions(+), 15 deletions(-)
drivers/oprofile/buffer_sync.c +14 -13
@@ -141,16 +141,6 @@ static struct notifier_block module_load_nb = { .notifier_call = module_load_notify, }; - -static void end_sync (void ) -{ -end_cpu_work (); -/* make sure we don't leak task structs */ -process_task_mortuary (); -process_task_mortuary (); -} - -int sync_start (void ) {int err;
@@ -158,7 +148,7 @@ int sync_start(void)if (!zalloc_cpumask_var (&marked_cpus,GFP_KERNEL ))return -ENOMEM ; -start_cpu_work (); +mutex_lock (&buffer_mutex); err =task_handoff_register (&task_free_nb);if (err)
@@ -173,7 +163,10 @@ int sync_start(void)if (err) goto out4; +start_cpu_work (); + out: +mutex_unlock (&buffer_mutex);return err; out4:profile_event_unregister (PROFILE_MUNMAP , &munmap_nb);
@@ -182,7 +175,6 @@ out3: out2:task_handoff_unregister (&task_free_nb); out1: -end_sync ();free_cpumask_var (marked_cpus); goto out; }
@@ -190,11 +182,20 @@ out1:void sync_stop (void ) { +/* flush buffers */ +mutex_lock (&buffer_mutex); +end_cpu_work ();unregister_module_notifier (&module_load_nb);profile_event_unregister (PROFILE_MUNMAP , &munmap_nb);profile_event_unregister (PROFILE_TASK_EXIT , &task_exit_nb);task_handoff_unregister (&task_free_nb); -end_sync (); +mutex_unlock (&buffer_mutex); +flush_scheduled_work (); + +/* make sure we don't leak task structs */ +process_task_mortuary (); +process_task_mortuary (); +free_cpumask_var (marked_cpus); }
drivers/oprofile/cpu_buffer.c +0 -2
@@ -120,8 +120,6 @@ void end_cpu_work(void)cancel_delayed_work (&b->work); } - -flush_scheduled_work (); }/*
Signature · 1 line
1.7.3.3
PATCH 59/260 oprofile, x86: fix init_sysfs error handling
In reply to Paul GortmakerFrom: Robert Richter <[email protected]>
commit 10f0412f57f2a76a90eff4376f59cbb0a39e4e18 upstream.
On failure init_sysfs() might not properly free resources. The error code of the function is not checked. And, when reinitializing the exit function might be called twice. This patch fixes all this.
--- arch/x86/oprofile/nmi_int.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
arch/x86/oprofile/nmi_int.c +13 -3
@@ -518,8 +518,13 @@ static int __init init_sysfs(void)int error; error =sysdev_class_register (&oprofile_sysclass); -if (!error) - error =sysdev_register (&device_oprofile); +if (error) +return error; + + error =sysdev_register (&device_oprofile); +if (error) +sysdev_class_unregister (&oprofile_sysclass); +return error; }
@@ -645,6 +650,8 @@ int __init op_nmi_init(struct oprofile_operations *ops)char *cpu_type =NULL ;int ret =0 ; + using_nmi =0 ; +if (!cpu_has_apic)return -ENODEV ;
@@ -727,7 +734,10 @@ int __init op_nmi_init(struct oprofile_operations *ops)mux_init (ops); -init_sysfs (); + ret =init_sysfs (); +if (ret) +return ret; + using_nmi =1 ;printk (KERN_INFO "oprofile: using NMI interrupt.\n" );return 0 ;
Signature · 1 line
1.7.3.3
PATCH 60/260 oprofile, x86: fix init_sysfs() function stub
In reply to Paul GortmakerFrom: Robert Richter <[email protected]>
commit 269f45c25028c75fe10e6d9be86e7202ab461fbc upstream.
The use of the return value of init_sysfs() with commit
10f0412 oprofile, x86: fix init_sysfs error handling
discovered the following build error for !CONFIG_PM:
.../linux/arch/x86/oprofile/nmi_int.c: In function ‘op_nmi_init’:
.../linux/arch/x86/oprofile/nmi_int.c:784: error: expected expression before ‘do’ make[2]: *** [arch/x86/oprofile/nmi_int.o] Error 1
make[1]: *** [arch/x86/oprofile] Error 2
This patch fixes this.
--- arch/x86/oprofile/nmi_int.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/oprofile/nmi_int.c +4 -2
@@ -535,8 +535,10 @@ static void exit_sysfs(void) }#else -#define init_sysfs () do { } while (0) -#define exit_sysfs () do { } while (0) + +static inline int init_sysfs (void ) {return 0 ; } +static inline void exit_sysfs (void ) { } +#endif /* CONFIG_PM */ static int __init p4_init (char **cpu_type)
Signature · 1 line
1.7.3.3
PATCH 61/260 libata: skip EH autopsy and recovery during suspend
In reply to Paul GortmakerFrom: Tejun Heo <[email protected]>
commit e2f3d75fc0e4a0d03c61872bad39ffa2e74a04ff upstream.
For some mysterious reason, certain hardware reacts badly to usual EH actions while the system is going for suspend. As the devices won't be needed until the system is resumed, ask EH to skip usual autopsy and recovery and proceed directly to suspend.
--- drivers/ata/libata-core.c | 14 +++++++++++++- drivers/ata/libata-eh.c | 4 ++++ include/linux/libata.h | 1 + 3 files changed, 18 insertions(+), 1 deletions(-)
drivers/ata/libata-core.c +13 -1
@@ -5526,6 +5526,7 @@ static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg,*/ int ata_host_suspend (struct ata_host *host,pm_message_t mesg) { +unsigned int ehi_flags =ATA_EHI_QUIET ;int rc;/*
@@ -5534,7 +5535,18 @@ int ata_host_suspend(struct ata_host *host, pm_message_t mesg)*/ ata_lpm_enable (host); - rc =ata_host_request_pm (host, mesg,0 ,ATA_EHI_QUIET ,1 ); +/* +* On some hardware, device fails to respond after spun down +* for suspend. As the device won't be used before being +* resumed, we don't need to touch the device. Ask EH to skip +* the usual stuff and proceed directly to suspend. +* +* http://thread.gmane.org/gmane.linux.ide/46764 +*/ +if (mesg.event ==PM_EVENT_SUSPEND ) + ehi_flags |=ATA_EHI_NO_AUTOPSY |ATA_EHI_NO_RECOVERY ; + + rc =ata_host_request_pm (host, mesg,0 , ehi_flags,1 );if (rc ==0 ) host->dev->power.power_state = mesg;return rc;
drivers/ata/libata-eh.c +4 -0
@@ -3234,6 +3234,10 @@ static int ata_eh_skip_recovery(struct ata_link *link)if (link->flags &ATA_LFLAG_DISABLED )return 1 ; +/* skip if explicitly requested */ +if (ehc->i.flags &ATA_EHI_NO_RECOVERY ) +return 1 ; +/* thaw frozen port and recover failed devices */ if ((ap->pflags &ATA_PFLAG_FROZEN ) ||ata_link_nr_enabled (link))return 0 ;
include/linux/libata.h +1 -0
@@ -340,6 +340,7 @@ enum {ATA_EHI_HOTPLUGGED = (1 <<0 ),/* could have been hotplugged */ ATA_EHI_NO_AUTOPSY = (1 <<2 ),/* no autopsy */ ATA_EHI_QUIET = (1 <<3 ),/* be quiet */ +ATA_EHI_NO_RECOVERY = (1 <<4 ),/* no recovery */ ATA_EHI_DID_SOFTRESET = (1 <<16 ),/* already soft-reset this port */ ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */
Signature · 1 line
1.7.3.3
PATCH 62/260 tracing: Fix a race in function profile
In reply to Paul GortmakerFrom: Li Zefan <[email protected]>
commit 3aaba20f26f58843e8f20611e5c0b1c06954310f upstream.
While we are reading trace_stat/functionX and someone just disabled function_profile at that time, we can trigger this:
divide error: 0000 [#1] PREEMPT SMP ... EIP is at function_stat_show+0x90/0x230 ...
This fix just takes the ftrace_profile_lock and checks if rec->counter is 0. If it's 0, we know the profile buffer has been reset.
LKML-Reference: <[email protected]>
--- kernel/trace/ftrace.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
kernel/trace/ftrace.c +11 -4
@@ -380,11 +380,18 @@ static int function_stat_show(struct seq_file *m, void *v) {struct ftrace_profile *rec = v;char str[KSYM_SYMBOL_LEN ]; +int ret =0 ;#ifdef CONFIG_FUNCTION_GRAPH_TRACER -static DEFINE_MUTEX (mutex);static struct trace_seq s;unsigned long long avg;#endif +mutex_lock (&ftrace_profile_lock); + +/* we raced with function_profile_reset() */ +if (unlikely (rec->counter ==0 )) { + ret = -EBUSY ; + goto out; + }kallsyms_lookup (rec->ip,NULL ,NULL ,NULL , str);seq_printf (m," %-30.30s %10lu" , str, rec->counter);
@@ -394,17 +401,17 @@ static int function_stat_show(struct seq_file *m, void *v) avg = rec->time;do_div (avg, rec->counter); -mutex_lock (&mutex);trace_seq_init (&s);trace_print_graph_duration (rec->time, &s);trace_seq_puts (&s," " );trace_print_graph_duration (avg, &s);trace_print_seq (m, &s); -mutex_unlock (&mutex);#endif seq_putc (m,'\n' ); +out: +mutex_unlock (&ftrace_profile_lock); -return 0 ; +return ret; }static void ftrace_profile_reset (struct ftrace_profile_stat *stat)
Signature · 1 line
1.7.3.3
PATCH 63/260 tracing: Do not allow llseek to set_ftrace_filter
In reply to Paul GortmakerFrom: Steven Rostedt <[email protected]>
commit 9c55cb12c1c172e2d51e85fbb5a4796ca86b77e7 upstream.
Reading the file set_ftrace_filter does three things.
1) shows whether or not filters are set for the function tracer
2) shows what functions are set for the function tracer
3) shows what triggers are set on any functions
3 is independent from 1 and 2.
The way this file currently works is that it is a state machine, and as you read it, it may change state. But this assumption breaks when you use lseek() on the file. The state machine gets out of sync and the t_show() may use the wrong pointer and cause a kernel oops.
Luckily, this will only kill the app that does the lseek, but the app dies while holding a mutex. This prevents anyone else from using the set_ftrace_filter file (or any other function tracing file for that matter).
A real fix for this is to rewrite the code, but that is too much for a -rc release or stable. This patch simply disables llseek on the set_ftrace_filter() file for now, and we can do the proper fix for the next major release.
--- kernel/trace/ftrace.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +1 -1
@@ -2395,7 +2395,7 @@ static const struct file_operations ftrace_filter_fops = { .open = ftrace_filter_open, .read = seq_read, .write = ftrace_filter_write, - .llseek = ftrace_regex_lseek, + .llseek = no_llseek, .release = ftrace_filter_release, };
Signature · 1 line
1.7.3.3
PATCH 64/260 tracing: t_start: reset FTRACE_ITER_HASH in case of seek/pread
In reply to Paul GortmakerFrom: Chris Wright <[email protected]>
commit df09162550fbb53354f0c88e85b5d0e6129ee9cc upstream.
Be sure to avoid entering t_show() with FTRACE_ITER_HASH set without having properly started the iterator to iterate the hash. This case is degenerate and, as discovered by Robert Swiecki, can cause t_hash_show() to misuse a pointer. This causes a NULL ptr deref with possible security implications. Tracked as CVE-2010-3079.
--- kernel/trace/ftrace.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/trace/ftrace.c +2 -0
@@ -1488,6 +1488,8 @@ static void *t_start(struct seq_file *m, loff_t *pos)if (*pos >0 )return t_hash_start (m, pos); iter->flags |=FTRACE_ITER_PRINTALL ; +/* reset in case of seek/pread */ + iter->flags &= ~FTRACE_ITER_HASH ;return iter; }
Signature · 1 line
1.7.3.3
PATCH 65/260 irda: off by one
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
commit cf9b94f88bdbe8a02015fc30d7c232b2d262d4ad upstream.
This is an off by one. We would go past the end when we NUL terminate the "value" string at end of the function. The "value" buffer is allocated in irlan_client_parse_response() or irlan_provider_parse_command().
--- net/irda/irlan/irlan_common.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/irda/irlan/irlan_common.c +1 -1
@@ -1102,7 +1102,7 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len)memcpy (&val_len, buf+n,2 );/* To avoid alignment problems */ le16_to_cpus (&val_len); n+=2 ; -if (val_len >1016 ) { +if (val_len >=1016 ) {IRDA_DEBUG (2 ,"%s(), parameter length to long\n" , __func__ );return -RSP_INVALID_COMMAND_FORMAT ; }
Signature · 1 line
1.7.3.3
PATCH 66/260 gcov: fix null-pointer dereference for certain module types
In reply to Paul GortmakerFrom: Peter Oberparleiter <[email protected]>
commit 85a0fdfd0f967507f3903e8419bc7e408f5a59de upstream.
The gcov-kernel infrastructure expects that each object file is loaded only once. This may not be true, e.g. when loading multiple kernel modules which are linked to the same object file. As a result, loading such kernel modules will result in incorrect gcov results while unloading will cause a null-pointer dereference.
This patch fixes these problems by changing the gcov-kernel infrastructure so that multiple profiling data sets can be associated with one debugfs entry. It applies to 2.6.36-rc1.
--- kernel/gcov/fs.c | 244 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 180 insertions(+), 64 deletions(-)
kernel/gcov/fs.c +180 -64
@@ -33,10 +33,11 @@* @children: child nodes * @all: list head for list of all nodes * @parent: parent node -* @info: associated profiling data structure if not a directory -* @ghost: when an object file containing profiling data is unloaded we keep a -* copy of the profiling data here to allow collecting coverage data -* for cleanup code. Such a node is called a "ghost". +* @loaded_info: array of pointers to profiling data sets for loaded object +* files. +* @num_loaded: number of profiling data sets for loaded object files. +* @unloaded_info: accumulated copy of profiling data sets for unloaded +* object files. Used only when gcov_persist=1. * @dentry: main debugfs entry, either a directory or data file * @links: associated symbolic links * @name: data file basename
@@ -51,10 +52,11 @@ struct gcov_node {struct list_head children;struct list_head all;struct gcov_node *parent; -struct gcov_info *info; -struct gcov_info *ghost; +struct gcov_info **loaded_info; +struct gcov_info *unloaded_info;struct dentry *dentry;struct dentry **links; +int num_loaded;char name[0 ]; };
@@ -136,16 +138,37 @@ static const struct seq_operations gcov_seq_ops = { };/* -* Return the profiling data set for a given node. This can either be the -* original profiling data structure or a duplicate (also called "ghost") -* in case the associated object file has been unloaded. +* Return a profiling data set associated with the given node. This is +* either a data set for a loaded object file or a data set copy in case +* all associated object files have been unloaded. */ static struct gcov_info *get_node_info (struct gcov_node *node) { -if (node->info) -return node->info; +if (node->num_loaded >0 ) +return node->loaded_info[0 ]; -return node->ghost; +return node->unloaded_info; +} + +/* +* Return a newly allocated profiling data set which contains the sum of +* all profiling data associated with the given node. +*/ +static struct gcov_info *get_accumulated_info (struct gcov_node *node) +{ +struct gcov_info *info; +int i =0 ; + +if (node->unloaded_info) + info =gcov_info_dup (node->unloaded_info); +else + info =gcov_info_dup (node->loaded_info[i++]); +if (!info) +return NULL ; +for (; i < node->num_loaded; i++) +gcov_info_add (info, node->loaded_info[i]); + +return info; }/*
@@ -163,9 +186,10 @@ static int gcov_seq_open(struct inode *inode, struct file *file)mutex_lock (&node_lock);/* * Read from a profiling data copy to minimize reference tracking -* complexity and concurrent access. +* complexity and concurrent access and to keep accumulating multiple +* profiling data sets associated with one node simple. */ - info =gcov_info_dup (get_node_info (node)); + info =get_accumulated_info (node);if (!info) goto out_unlock; iter =gcov_iter_new (info);
@@ -225,12 +249,25 @@ static struct gcov_node *get_node_by_name(const char *name)return NULL ; } +/* +* Reset all profiling data associated with the specified node. +*/ +static void reset_node (struct gcov_node *node) +{ +int i; + +if (node->unloaded_info) +gcov_info_reset (node->unloaded_info); +for (i =0 ; i < node->num_loaded; i++) +gcov_info_reset (node->loaded_info[i]); +} +static void remove_node (struct gcov_node *node);/* * write() implementation for gcov data files. Reset profiling data for the -* associated file. If the object file has been unloaded (i.e. this is -* a "ghost" node), remove the debug fs node as well. +* corresponding file. If all associated object files have been unloaded, +* remove the debug fs node as well. */ static ssize_t gcov_seq_write (struct file *file,const char __user *addr,size_t len,loff_t *pos)
@@ -245,10 +282,10 @@ static ssize_t gcov_seq_write(struct file *file, const char __user *addr, node =get_node_by_name (info->filename);if (node) {/* Reset counts or remove node for unloaded modules. */ -if (node->ghost) +if (node->num_loaded ==0 )remove_node (node);else -gcov_info_reset (node->info); +reset_node (node); }/* Reset counts for open file. */ gcov_info_reset (info);
@@ -378,7 +415,10 @@ static void init_node(struct gcov_node *node, struct gcov_info *info,INIT_LIST_HEAD (&node->list);INIT_LIST_HEAD (&node->children);INIT_LIST_HEAD (&node->all); - node->info = info; +if (node->loaded_info) { + node->loaded_info[0 ] = info; + node->num_loaded =1 ; + } node->parent = parent;if (name)strcpy (node->name, name);
@@ -394,9 +434,13 @@ static struct gcov_node *new_node(struct gcov_node *parent,struct gcov_node *node; node =kzalloc (sizeof (struct gcov_node ) +strlen (name) +1 ,GFP_KERNEL ); -if (!node) { -pr_warning ("out of memory\n" ); -return NULL ; +if (!node) + goto err_nomem; +if (info) { + node->loaded_info =kcalloc (1 ,sizeof (struct gcov_info *), +GFP_KERNEL ); +if (!node->loaded_info) + goto err_nomem; }init_node (node, info, name, parent);/* Differentiate between gcov data file nodes and directory nodes. */
@@ -416,6 +460,11 @@ static struct gcov_node *new_node(struct gcov_node *parent,list_add (&node->all, &all_head);return node; + +err_nomem: +kfree (node); +pr_warning ("out of memory\n" ); +return NULL ; }/* Remove symbolic links associated with node. */
@@ -441,8 +490,9 @@ static void release_node(struct gcov_node *node)list_del (&node->all);debugfs_remove (node->dentry);remove_links (node); -if (node->ghost) -gcov_info_free (node->ghost); +kfree (node->loaded_info); +if (node->unloaded_info) +gcov_info_free (node->unloaded_info);kfree (node); }
@@ -477,7 +527,7 @@ static struct gcov_node *get_child_by_name(struct gcov_node *parent,/* * write() implementation for reset file. Reset all profiling data to zero -* and remove ghost nodes. +* and remove nodes for which all associated object files are unloaded. */ static ssize_t reset_write (struct file *file,const char __user *addr,size_t len,loff_t *pos)
@@ -487,8 +537,8 @@ static ssize_t reset_write(struct file *file, const char __user *addr,mutex_lock (&node_lock); restart:list_for_each_entry (node, &all_head, all) { -if (node->info) -gcov_info_reset (node->info); +if (node->num_loaded >0 ) +reset_node (node);else if (list_empty (&node->children)) {remove_node (node);/* Several nodes may have gone - restart loop. */
@@ -564,37 +614,115 @@ err_remove: }/* -* The profiling data set associated with this node is being unloaded. Store a -* copy of the profiling data and turn this node into a "ghost". +* Associate a profiling data set with an existing node. Needs to be called +* with node_lock held. */ -static int ghost_node (struct gcov_node *node) +static void add_info (struct gcov_node *node,struct gcov_info *info) { - node->ghost =gcov_info_dup (node->info); -if (!node->ghost) { -pr_warning ("could not save data for '%s' (out of memory)\n" , - node->info->filename); -return -ENOMEM ; +struct gcov_info **loaded_info; +int num = node->num_loaded; + +/* +* Prepare new array. This is done first to simplify cleanup in +* case the new data set is incompatible, the node only contains +* unloaded data sets and there's not enough memory for the array. +*/ + loaded_info =kcalloc (num +1 ,sizeof (struct gcov_info *),GFP_KERNEL ); +if (!loaded_info) { +pr_warning ("could not add '%s' (out of memory)\n" , + info->filename); +return ; + } +memcpy (loaded_info, node->loaded_info, + num *sizeof (struct gcov_info *)); + loaded_info[num] = info; +/* Check if the new data set is compatible. */ +if (num ==0 ) { +/* +* A module was unloaded, modified and reloaded. The new +* data set replaces the copy of the last one. +*/ +if (!gcov_info_is_compatible (node->unloaded_info, info)) { +pr_warning ("discarding saved data for %s " +"(incompatible version)\n" , info->filename); +gcov_info_free (node->unloaded_info); + node->unloaded_info =NULL ; + } + }else { +/* +* Two different versions of the same object file are loaded. +* The initial one takes precedence. +*/ +if (!gcov_info_is_compatible (node->loaded_info[0 ], info)) { +pr_warning ("could not add '%s' (incompatible " +"version)\n" , info->filename); +kfree (loaded_info); +return ; + } } - node->info =NULL ; +/* Overwrite previous array. */ +kfree (node->loaded_info); + node->loaded_info = loaded_info; + node->num_loaded = num +1 ; +} -return 0 ; +/* +* Return the index of a profiling data set associated with a node. +*/ +static int get_info_index (struct gcov_node *node,struct gcov_info *info) +{ +int i; + +for (i =0 ; i < node->num_loaded; i++) { +if (node->loaded_info[i] == info) +return i; + } +return -ENOENT ; }/* -* Profiling data for this node has been loaded again. Add profiling data -* from previous instantiation and turn this node into a regular node. +* Save the data of a profiling data set which is being unloaded. */ -static void revive_node (struct gcov_node *node,struct gcov_info *info) +static void save_info (struct gcov_node *node,struct gcov_info *info) { -if (gcov_info_is_compatible (node->ghost, info)) -gcov_info_add (info, node->ghost); +if (node->unloaded_info) +gcov_info_add (node->unloaded_info, info);else { -pr_warning ("discarding saved data for '%s' (version changed)\n" , + node->unloaded_info =gcov_info_dup (info); +if (!node->unloaded_info) { +pr_warning ("could not save data for '%s' " +"(out of memory)\n" , info->filename); + } + } +} + +/* +* Disassociate a profiling data set from a node. Needs to be called with +* node_lock held. +*/ +static void remove_info (struct gcov_node *node,struct gcov_info *info) +{ +int i; + + i =get_info_index (node, info); +if (i <0 ) { +pr_warning ("could not remove '%s' (not found)\n" , info->filename); +return ; } -gcov_info_free (node->ghost); - node->ghost =NULL ; - node->info = info; +if (gcov_persist) +save_info (node, info); +/* Shrink array. */ + node->loaded_info[i] = node->loaded_info[node->num_loaded -1 ]; + node->num_loaded--; +if (node->num_loaded >0 ) +return ; +/* Last loaded data set was removed. */ +kfree (node->loaded_info); + node->loaded_info =NULL ; + node->num_loaded =0 ; +if (!node->unloaded_info) +remove_node (node); }/*
@@ -609,30 +737,18 @@ void gcov_event(enum gcov_action action, struct gcov_info *info) node =get_node_by_name (info->filename);switch (action) {case GCOV_ADD : -/* Add new node or revive ghost. */ -if (!node) { +if (node) +add_info (node, info); +else add_node (info); -break ; - } -if (gcov_persist) -revive_node (node, info); -else { -pr_warning ("could not add '%s' (already exists)\n" , - info->filename); - }break ;case GCOV_REMOVE : -/* Remove node or turn into ghost. */ -if (!node) { +if (node) +remove_info (node, info); +else {pr_warning ("could not remove '%s' (not found)\n" , info->filename); -break ; } -if (gcov_persist) { -if (!ghost_node (node)) -break ; - } -remove_node (node);break ; }mutex_unlock (&node_lock);
Signature · 1 line
1.7.3.3
PATCH 67/260 tmio_mmc: don't clear unhandled pending interrupts
In reply to Paul GortmakerFrom: Yusuke Goda <[email protected]>
commit b78d6c5f51935ba89df8db33a57bacb547aa7325 upstream.
Previously, it was possible for ack_mmc_irqs() to clear pending interrupt bits in the CTL_STATUS register, even though the interrupt handler had not been called. This was because of a race that existed when doing a read-modify-write sequence on CTL_STATUS. After the read step in this sequence, if an interrupt occurred (causing one of the bits in CTL_STATUS to be set) the write step would inadvertently clear it.
Observed with the TMIO_STAT_RXRDY bit together with CMD53 on AR6002 and BCM4318 SDIO cards in polled mode.
This patch eliminates this race by only writing to CTL_STATUS and clearing the interrupts that were passed as an argument to ack_mmc_irqs()."
--- drivers/mmc/host/tmio_mmc.h | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/mmc/host/tmio_mmc.h +1 -4
@@ -80,10 +80,7 @@#define ack_mmc_irqs (host, i) \ do { \ - u32 mask;\ - mask = sd_ctrl_read32((host), CTL_STATUS); \ - mask &= ~((i) & TMIO_MASK_IRQ); \ - sd_ctrl_write32((host), CTL_STATUS, mask); \ + sd_ctrl_write32((host), CTL_STATUS, ~(i)); \ } while (0)
Signature · 1 line
1.7.3.3
PATCH 68/260 mmc: fix the use of kunmap_atomic() in tmio_mmc.h
In reply to Paul GortmakerFrom: Guennadi Liakhovetski <[email protected]>
commit 5600efb1bc2745d93ae0bc08130117a84f2b9d69 upstream.
kunmap_atomic() takes the cookie, returned by the kmap_atomic() as its argument and not the page address, used as an argument to kmap_atomic(). This patch fixes the compile error:
In file included from drivers/mmc/host/tmio_mmc.c:37:drivers/mmc/host/tmio_mmc.h: In function 'tmio_mmc_kunmap_atomic':drivers/mmc/host/tmio_mmc.h:192: error: negative width in bit-field '<anonymous>'
--- drivers/mmc/host/tmio_mmc.c | 7 ++++--- drivers/mmc/host/tmio_mmc.h | 8 +++----- 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/mmc/host/tmio_mmc.c +4 -3
@@ -163,6 +163,7 @@ tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)static inline void tmio_mmc_pio_irq (struct tmio_mmc_host *host) {struct mmc_data *data = host->data; +void *sg_virt;unsigned short *buf;unsigned int count;unsigned long flags;
@@ -172,8 +173,8 @@ static inline void tmio_mmc_pio_irq(struct tmio_mmc_host *host)return ; } - buf = (unsigned short *)(tmio_mmc_kmap_atomic (host, &flags) + - host->sg_off); + sg_virt =tmio_mmc_kmap_atomic (host->sg_ptr, &flags); + buf = (unsigned short *)(sg_virt + host->sg_off); count = host->sg_ptr->length - host->sg_off;if (count > data->blksz)
@@ -190,7 +191,7 @@ static inline void tmio_mmc_pio_irq(struct tmio_mmc_host *host) host->sg_off += count; -tmio_mmc_kunmap_atomic (host, &flags); +tmio_mmc_kunmap_atomic (sg_virt, &flags);if (host->sg_off == host->sg_ptr->length)tmio_mmc_next_sg (host);
drivers/mmc/host/tmio_mmc.h +3 -5
@@ -161,19 +161,17 @@ static inline int tmio_mmc_next_sg(struct tmio_mmc_host *host)return --host->sg_len; } -static inline char *tmio_mmc_kmap_atomic (struct tmio_mmc_host *host, +static inline char *tmio_mmc_kmap_atomic (struct scatterlist *sg,unsigned long *flags) { -struct scatterlist *sg = host->sg_ptr; -local_irq_save (*flags);return kmap_atomic (sg_page (sg),KM_BIO_SRC_IRQ ) + sg->offset; } -static inline void tmio_mmc_kunmap_atomic (struct tmio_mmc_host *host, +static inline void tmio_mmc_kunmap_atomic (void *virt,unsigned long *flags) { -kunmap_atomic (sg_page (host->sg_ptr),KM_BIO_SRC_IRQ ); +kunmap_atomic (virt,KM_BIO_SRC_IRQ );local_irq_restore (*flags); }
Signature · 1 line
1.7.3.3
PATCH 69/260 bounce: call flush_dcache_page() after bounce_copy_vec()
In reply to Paul GortmakerFrom: Gary King <[email protected]>
commit ac8456d6f9a3011c824176bd6084d39e5f70a382 upstream.
I have been seeing problems on Tegra 2 (ARMv7 SMP) systems with HIGHMEM enabled on 2.6.35 (plus some patches targetted at 2.6.36 to perform cache maintenance lazily), and the root cause appears to be that the mm bouncing code is calling flush_dcache_page before it copies the bounce buffer into the bio.
The bounced page needs to be flushed after data is copied into it, to ensure that architecture implementations can synchronize instruction and data caches if necessary.
--- mm/bounce.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
mm/bounce.c +1 -1
@@ -116,8 +116,8 @@ static void copy_to_high_bio_irq(struct bio *to, struct bio *from)*/ vfrom =page_address (fromvec->bv_page) + tovec->bv_offset; -flush_dcache_page (tovec->bv_page);bounce_copy_vec (tovec, vfrom); +flush_dcache_page (tovec->bv_page); } }
Signature · 1 line
1.7.3.3
PATCH 70/260 kernel/groups.c: fix integer overflow in groups_search
In reply to Paul GortmakerFrom: Jerome Marchand <[email protected]>
commit 1c24de60e50fb19b94d94225458da17c720f0729 upstream.
gid_t is a unsigned int. If group_info contains a gid greater than MAX_INT, groups_search() function may look on the wrong side of the search tree.
This solves some unfair "permission denied" problems.
--- kernel/groups.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
kernel/groups.c +2 -3
@@ -143,10 +143,9 @@ int groups_search(const struct group_info *group_info, gid_t grp) right = group_info->ngroups;while (left < right) {unsigned int mid = (left+right)/2 ; -int cmp = grp -GROUP_AT (group_info, mid); -if (cmp >0 ) +if (grp >GROUP_AT (group_info, mid)) left = mid +1 ; -else if (cmp <0 ) +else if (grp <GROUP_AT (group_info, mid)) right = mid;else return 1 ;
Signature · 1 line
1.7.3.3
PATCH 71/260 binfmt_misc: fix binfmt_misc priority
In reply to Paul GortmakerFrom: Jan Sembera <[email protected]>
commit ee3aebdd8f5f8eac41c25c80ceee3d728f920f3b upstream.
Commit 74641f584da ("alpha: binfmt_aout fix") (May 2009) introduced a regression - binfmt_misc is now consulted after binfmt_elf, which will unfortunately break ia32el. ia32 ELF binaries on ia64 used to be matched using binfmt_misc and executed using wrapper. As 32bit binaries are now matched by binfmt_elf before bindmt_misc kicks in, the wrapper is ignored.
The fix increases precedence of binfmt_misc to the original state.
--- fs/binfmt_misc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/binfmt_misc.c +1 -1
@@ -723,7 +723,7 @@ static int __init init_misc_binfmt(void) {int err =register_filesystem (&bm_fs_type);if (!err) { - err =register_binfmt (&misc_format); + err =insert_binfmt (&misc_format);if (err)unregister_filesystem (&bm_fs_type); }
Signature · 1 line
1.7.3.3
PATCH 72/260 Input: i8042 - fix device removal on unload
In reply to Paul GortmakerFrom: Dmitry Torokhov <[email protected]>
commit af045b86662f17bf130239a65995c61a34f00a6b upstream.
We need to call platform_device_unregister(i8042_platform_device) before calling platform_driver_unregister() because i8042_remove() resets i8042_platform_device to NULL. This leaves the platform device instance behind and prevents driver reload.
Fixes https://bugzilla.kernel.org/show_bug.cgi?id=16613
--- drivers/input/serio/i8042.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/input/serio/i8042.c +1 -1
@@ -1483,8 +1483,8 @@ static int __init i8042_init(void) static void __exit i8042_exit(void) { -platform_driver_unregister (&i8042_driver);platform_device_unregister (i8042_platform_device); +platform_driver_unregister (&i8042_driver);i8042_platform_exit (); panic_blink =NULL ;
Signature · 1 line
1.7.3.3
PATCH 73/260 memory hotplug: fix next block calculation in is_removable
In reply to Paul GortmakerFrom: KAMEZAWA Hiroyuki <[email protected]>
commit 0dcc48c15f63ee86c2fcd33968b08d651f0360a5 upstream.
next_active_pageblock() is for finding next _used_ freeblock. It skips several blocks when it finds there are a chunk of free pages lager than pageblock. But it has 2 bugs.
1. We have no lock. page_order(page) - pageblock_order can be minus.
2. pageblocks_stride += is wrong. it should skip page_order(p) of pages.
--- mm/memory_hotplug.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
mm/memory_hotplug.c +8 -8
@@ -558,19 +558,19 @@ static inline int pageblock_free(struct page *page)/* Return the start of the next active pageblock after a given page */ static struct page *next_active_pageblock (struct page *page) { -int pageblocks_stride; -/* Ensure the starting page is pageblock-aligned */ BUG_ON (page_to_pfn (page) & (pageblock_nr_pages -1 )); -/* Move forward by at least 1 * pageblock_nr_pages */ - pageblocks_stride =1 ; -/* If the entire pageblock is free, move to the end of free page */ -if (pageblock_free (page)) - pageblocks_stride +=page_order (page) - pageblock_order; +if (pageblock_free (page)) { +int order; +/* be careful. we don't have locks, page_order can be changed.*/ + order =page_order (page); +if ((order <MAX_ORDER ) && (order >= pageblock_order)) +return page + (1 << order); + } -return page + (pageblocks_stride * pageblock_nr_pages); +return page + pageblock_nr_pages; }/* Checks if this range of memory is likely to be hot-removable. */
Signature · 1 line
1.7.3.3
PATCH 74/260 perf: Initialize callchains roots's childen hits
In reply to Paul GortmakerFrom: Frederic Weisbecker <[email protected]>
commit 5225c45899e872383ca39f5533d28ec63c54b39e upstream.
Each histogram entry has a callchain root that stores the callchain samples. However we forgot to initialize the tracking of children hits of these roots, which then got random values on their creation.
The root children hits is multiplied by the minimum percentage of hits provided by the user, and the result becomes the minimum hits expected from children branches. If the random value due to the uninitialization is big enough, then this minimum number of hits can be huge and eventually filter every children branches.
The end result was invisible callchains. All we need to fix this is to initialize the children hits of the root.
--- tools/perf/util/callchain.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
tools/perf/util/callchain.h +1 -0
@@ -49,6 +49,7 @@ static inline void callchain_init(struct callchain_node *node)INIT_LIST_HEAD (&node->children);INIT_LIST_HEAD (&node->val); + node->children_hit =0 ; node->parent =NULL ; node->hit =0 ; }
Signature · 1 line
1.7.3.3
PATCH 75/260 p54: fix tx feedback status flag check
In reply to Paul GortmakerFrom: Christian Lamparter <[email protected]>
commit f880c2050f30b23c9b6f80028c09f76e693bf309 upstream.
Michael reported that p54* never really entered power save mode, even tough it was enabled.
It turned out that upon a power save mode change the firmware will set a special flag onto the last outgoing frame tx status (which in this case is almost always the designated PSM nullfunc frame). This flag confused the driver; It erroneously reported transmission failures to the stack, which then generated the next nullfunc. and so on...
--- drivers/net/wireless/p54/txrx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/p54/txrx.c +1 -1
@@ -445,7 +445,7 @@ static void p54_rx_frame_sent(struct p54_common *priv, struct sk_buff *skb) }if (!(info->flags &IEEE80211_TX_CTL_NO_ACK ) && - (!payload->status)) + !(payload->status &P54_TX_FAILED )) info->flags |=IEEE80211_TX_STAT_ACK ;if (payload->status &P54_TX_PSM_CANCELLED ) info->flags |=IEEE80211_TX_STAT_TX_FILTERED ;
Signature · 1 line
1.7.3.3
PATCH 76/260 ath5k: check return value of ieee80211_get_tx_rate
In reply to Paul GortmakerFrom: John W. Linville <[email protected]>
commit d8e1ba76d619dbc0be8fbeee4e6c683b5c812d3a upstream.
This avoids a NULL pointer dereference as reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=625889
When the WARN condition is hit in ieee80211_get_tx_rate, it will return NULL. So, we need to check the return value and avoid dereferencing it in that case.
--- drivers/net/wireless/ath/ath5k/base.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +4 -0
@@ -1316,6 +1316,10 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf, PCI_DMA_TODEVICE); rate =ieee80211_get_tx_rate (sc->hw, info); +if (!rate) { + ret = -EINVAL ; + goto err_unmap; + }if (info->flags &IEEE80211_TX_CTL_NO_ACK ) flags |=AR5K_TXDESC_NOACK ;
Signature · 1 line
1.7.3.3
PATCH 77/260 wireless extensions: fix kernel heap content leak
In reply to Paul GortmakerFrom: Johannes Berg <[email protected]>
commit 42da2f948d949efd0111309f5827bf0298bcc9a4 upstream.
Wireless extensions have an unfortunate, undocumented requirement which requires drivers to always fill iwp->length when returning a successful status. When a driver doesn't do this, it leads to a kernel heap content leak when userspace offers a larger buffer than would have been necessary.
Arguably, this is a driver bug, as it should, if it returns 0, fill iwp->length, even if it separately indicated that the buffer contents was not valid.
However, we can also at least avoid the memory content leak if the driver doesn't do this by setting the iwp length to max_tokens, which then reflects how big the buffer is that the driver may fill, regardless of how big the userspace buffer is.
To illustrate the point, this patch also fixes a corresponding cfg80211 bug (since this requirement isn't documented nor was ever pointed out by anyone during code review, I don't trust all drivers nor all cfg80211 handlers to implement it correctly).
--- net/wireless/wext-compat.c | 3 +++ net/wireless/wext-core.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-)
net/wireless/wext-compat.c +3 -0
@@ -1415,6 +1415,9 @@ int cfg80211_wext_giwessid(struct net_device *dev, {struct wireless_dev *wdev = dev->ieee80211_ptr; + data->flags =0 ; + data->length =0 ; +switch (wdev->iftype) {case NL80211_IFTYPE_ADHOC :return cfg80211_ibss_wext_giwessid (dev, info, data, ssid);
net/wireless/wext-core.c +16 -0
@@ -782,6 +782,22 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd, } } +if (IW_IS_GET (cmd) && !(descr->flags &IW_DESCR_FLAG_NOMAX )) { +/* +* If this is a GET, but not NOMAX, it means that the extra +* data is not bounded by userspace, but by max_tokens. Thus +* set the length to max_tokens. This matches the extra data +* allocation. +* The driver should fill it with the number of tokens it +* provided, and it may check iwp->length rather than having +* knowledge of max_tokens. If the driver doesn't change the +* iwp->length, this ioctl just copies back max_token tokens +* filled with zeroes. Hopefully the driver isn't claiming +* them to be valid data. +*/ + iwp->length = descr->max_tokens; + } + err =handler (dev, info, (union iwreq_data *) iwp, extra); iwp->length += essid_compat;
Signature · 1 line
1.7.3.3
PATCH 78/260 x86, tsc: Fix a preemption leak in restore_sched_clock_state()
In reply to Paul GortmakerFrom: Peter Zijlstra <[email protected]>
commit 55496c896b8a695140045099d4e0175cf09d4eae upstream.
Doh, a real life genuine preemption leak..
This caused a suspend failure.
Reported-bisected-and-tested-by-the-invaluable: Jeff Chua <[email protected]>
sleep states
LKML-Reference: <1284150773.402.122.camel@laptop>
--- arch/x86/kernel/tsc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/tsc.c +1 -1
@@ -655,7 +655,7 @@ void restore_sched_clock_state(void)local_irq_save (flags); -get_cpu_var (cyc2ns_offset) =0 ; +__get_cpu_var (cyc2ns_offset) =0 ; offset = cyc2ns_suspend -sched_clock ();for_each_possible_cpu (cpu)
Signature · 1 line
1.7.3.3
Re: [34-longterm 078/260] x86, tsc: Fix a preemption leak in restore_sched_clock_state()
Good morning,
Paul Gortmaker [Sun, Jan 02, 2011 at 02:16:14AM -0500]:
Quoted 9 lines
From: Peter Zijlstra <[email protected]>
commit
55496c896b8a695140045099d4e0175cf09d4eaeupstream.arch/x86/kernel/tsc.c +0
-0
arch/x86/kernel/tsc.c void restore_sched_clock_state(void) · line 659
Quoted 6 lines
arch/x86/kernel/tsc.c +1
-1@@ -655,7 +655,7 @@ void restore_sched_clock_state(void)local_irq_save (flags); -get_cpu_var (cyc2ns_offset) =0 ; +__get_cpu_var (cyc2ns_offset) =0 ; offset = cyc2ns_suspend -sched_clock ();
If I see that correctly, this has already been merged before 2.6.37-rc7. As 2.6.37-rc7 again has the dark screen issue [0] I assume this does not fix this issue.
I am compiling v2.6.37-rc8-33-gb518a64 right now, to give it a try.
Cheers,
Nico
[0]: Subject: 2.6.37-rc7: screen black after several suspends
Signature · 1 line
PGP key: 7ED9 F7D3 6B10 81D7 0EC5 5C09 D7DC C8E4 3187 7DF0
PATCH 79/260 x86-64, compat: Test %rax for the syscall number, not %eax
In reply to Paul GortmakerFrom: H. Peter Anvin <[email protected]>
commit 36d001c70d8a0144ac1d038f6876c484849a74de upstream.
On 64 bits, we always, by necessity, jump through the system call table via %rax. For 32-bit system calls, in theory the system call number is stored in %eax, and the code was testing %eax for a valid system call number. At one point we loaded the stored value back from the stack to enforce zero-extension, but that was removed in checkin d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process will not be able to introduce a non-zero-extended number, but it can happen via ptrace.
Instead of re-introducing the zero-extension, test what we are actually going to use, i.e. %rax. This only adds a handful of REX prefixes to the code.
--- arch/x86/ia32/ia32entry.S | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
arch/x86/ia32/ia32entry.S +7 -7
@@ -153,7 +153,7 @@ ENTRY(ia32_sysenter_target) testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) CFI_REMEMBER_STATE jnz sysenter_tracesys - cmpl $(IA32_NR_syscalls-1),%eax + cmpq $(IA32_NR_syscalls-1),%rax ja ia32_badsys sysenter_do_call: IA32_ARG_FIXUP
@@ -195,7 +195,7 @@ sysexit_from_sys_call: movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */ call audit_syscall_entry movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */ - cmpl $(IA32_NR_syscalls-1),%eax + cmpq $(IA32_NR_syscalls-1),%rax ja ia32_badsys movl %ebx,%edi /* reload 1st syscall arg */ movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */
@@ -248,7 +248,7 @@ sysenter_tracesys: call syscall_trace_enter LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ RESTORE_REST - cmpl $(IA32_NR_syscalls-1),%eax + cmpq $(IA32_NR_syscalls-1),%rax ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */ jmp sysenter_do_call CFI_ENDPROC
@@ -314,7 +314,7 @@ ENTRY(ia32_cstar_target) testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) CFI_REMEMBER_STATE jnz cstar_tracesys - cmpl $IA32_NR_syscalls-1,%eax + cmpq $IA32_NR_syscalls-1,%rax ja ia32_badsys cstar_do_call: IA32_ARG_FIXUP 1
@@ -367,7 +367,7 @@ cstar_tracesys: LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */ RESTORE_REST xchgl %ebp,%r9d - cmpl $(IA32_NR_syscalls-1),%eax + cmpq $(IA32_NR_syscalls-1),%rax ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */ jmp cstar_do_call END(ia32_cstar_target)
@@ -425,7 +425,7 @@ ENTRY(ia32_syscall) orl $TS_COMPAT,TI_status(%r10) testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) jnz ia32_tracesys - cmpl $(IA32_NR_syscalls-1),%eax + cmpq $(IA32_NR_syscalls-1),%rax ja ia32_badsys ia32_do_call: IA32_ARG_FIXUP
@@ -444,7 +444,7 @@ ia32_tracesys: call syscall_trace_enter LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ RESTORE_REST - cmpl $(IA32_NR_syscalls-1),%eax + cmpq $(IA32_NR_syscalls-1),%rax ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */ jmp ia32_do_call END(ia32_syscall)
Signature · 1 line
1.7.3.3
PATCH 80/260 compat: Make compat_alloc_user_space() incorporate the access_ok()
In reply to Paul GortmakerFrom: H. Peter Anvin <[email protected]>
commit c41d68a513c71e35a14f66d71782d27a79a81ea6 upstream.
compat_alloc_user_space() expects the caller to independently call access_ok() to verify the returned area. A missing call could introduce problems on some architectures.
This patch incorporates the access_ok() check into compat_alloc_user_space() and also adds a sanity check on the length. The existing compat_alloc_user_space() implementations are renamed arch_compat_alloc_user_space() and are used as part of the implementation of the new global function.
This patch assumes NULL will cause __get_user()/__put_user() to either fail or access userspace on all architectures. This should be followed by checking the return value of compat_access_user_space() for NULL in the callers, at which time the access_ok() in the callers can also be removed.
--- arch/ia64/include/asm/compat.h | 2 +- arch/mips/include/asm/compat.h | 2 +- arch/parisc/include/asm/compat.h | 2 +- arch/powerpc/include/asm/compat.h | 2 +- arch/s390/include/asm/compat.h | 2 +- arch/sparc/include/asm/compat.h | 2 +- arch/x86/include/asm/compat.h | 2 +- include/linux/compat.h | 3 +++ kernel/compat.c | 21 +++++++++++++++++++++ 9 files changed, 31 insertions(+), 7 deletions(-)
arch/ia64/include/asm/compat.h +1 -1
@@ -199,7 +199,7 @@ ptr_to_compat(void __user *uptr) }static __inline__void __user * -compat_alloc_user_space (long len) +arch_compat_alloc_user_space (long len) {struct pt_regs *regs =task_pt_regs (current);return (void __user *) (((regs->r12 &0xffffffff ) &-16 ) - len);
arch/mips/include/asm/compat.h +1 -1
@@ -145,7 +145,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)return (u32 )(unsigned long )uptr; } -static inline void __user *compat_alloc_user_space (long len) +static inline void __user *arch_compat_alloc_user_space (long len) {struct pt_regs *regs = (struct pt_regs *) ((unsigned long )current_thread_info () +THREAD_SIZE -32 ) -1 ;
arch/parisc/include/asm/compat.h +1 -1
@@ -147,7 +147,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)return (u32 )(unsigned long )uptr; } -static __inline__void __user *compat_alloc_user_space (long len) +static __inline__void __user *arch_compat_alloc_user_space (long len) {struct pt_regs *regs = ¤t->thread.regs;return (void __user *)regs->gr[30 ];
arch/powerpc/include/asm/compat.h +1 -1
@@ -134,7 +134,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)return (u32 )(unsigned long )uptr; } -static inline void __user *compat_alloc_user_space (long len) +static inline void __user *arch_compat_alloc_user_space (long len) {struct pt_regs *regs = current->thread.regs;unsigned long usp = regs->gpr[1 ];
arch/s390/include/asm/compat.h +1 -1
@@ -181,7 +181,7 @@ static inline int is_compat_task(void)#endif -static inline void __user *compat_alloc_user_space (long len) +static inline void __user *arch_compat_alloc_user_space (long len) {unsigned long stack;
arch/sparc/include/asm/compat.h +1 -1
@@ -167,7 +167,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)return (u32 )(unsigned long )uptr; } -static inline void __user *compat_alloc_user_space (long len) +static inline void __user *arch_compat_alloc_user_space (long len) {struct pt_regs *regs =current_thread_info ()->kregs;unsigned long usp = regs->u_regs[UREG_I6 ];
arch/x86/include/asm/compat.h +1 -1
@@ -205,7 +205,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)return (u32 )(unsigned long )uptr; } -static inline void __user *compat_alloc_user_space (long len) +static inline void __user *arch_compat_alloc_user_space (long len) {struct pt_regs *regs =task_pt_regs (current);return (void __user *)regs->sp - len;
include/linux/compat.h +3 -0
@@ -360,5 +360,8 @@ extern ssize_t compat_rw_copy_check_uvector(int type, const struct compat_iovec __user *uvector, unsigned long nr_segs, unsigned long fast_segs, struct iovec *fast_pointer, struct iovec **ret_pointer); + +extern void __user *compat_alloc_user_space (unsigned long len); +#endif /* CONFIG_COMPAT */ #endif /* _LINUX_COMPAT_H */
kernel/compat.c +21 -0
@@ -1137,3 +1137,24 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info)return 0 ; } + +/* +* Allocate user-space memory for the duration of a single system call, +* in order to marshall parameters inside a compat thunk. +*/ +void __user *compat_alloc_user_space (unsigned long len) +{ +void __user *ptr; + +/* If len would occupy more than half of the entire compat space... */ +if (unlikely (len > (((compat_uptr_t )~0 ) >>1 ))) +return NULL ; + + ptr =arch_compat_alloc_user_space (len); + +if (unlikely (!access_ok (VERIFY_WRITE , ptr, len))) +return NULL ; + +return ptr; +} +EXPORT_SYMBOL_GPL (compat_alloc_user_space);
Signature · 1 line
1.7.3.3
PATCH 81/260 x86-64, compat: Retruncate rax after ia32 syscall entry tracing
In reply to Paul GortmakerFrom: Roland McGrath <[email protected]>
commit eefdca043e8391dcd719711716492063030b55ac upstream.
In commit d4d6715, we reopened an old hole for a 64-bit ptracer touching a 32-bit tracee in system call entry. A %rax value set via ptrace at the entry tracing stop gets used whole as a 32-bit syscall number, while we only check the low 32 bits for validity.
Fix it by truncating %rax back to 32 bits after syscall_trace_enter, in addition to testing the full 64 bits as has already been added.
--- arch/x86/ia32/ia32entry.S | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
arch/x86/ia32/ia32entry.S +7 -1
@@ -50,7 +50,12 @@ /* * Reload arg registers from stack in case ptrace changed them. * We don't reload %eax because syscall_trace_enter() returned - * the value it wants us to use in the table lookup. + * the %rax value we should see. Instead, we just truncate that + * value to 32 bits again as we did on entry from user mode. + * If it's a new value set by user_regset during entry tracing, + * this matches the normal truncation of the user-mode value. + * If it's -1 to make us punt the syscall, then (u32)-1 is still + * an appropriately invalid value. */ .macro LOAD_ARGS32 offset, _r9=0 .if \_r9
@@ -60,6 +65,7 @@ movl \offset+48(%rsp),%edx movl \offset+56(%rsp),%esi movl \offset+64(%rsp),%edi + movl %eax,%eax /* zero extension */ .endm .macro CFI_STARTPROC32 simple
Signature · 1 line
1.7.3.3
PATCH 82/260 sched: Kill the broken and deadlockable cpuset_lock/cpuset_cpus_allowed_locked code
In reply to Paul GortmakerFrom: Oleg Nesterov <[email protected]>
commit 897f0b3c3ff40b443c84e271bef19bd6ae885195 upstream.
This patch just states the fact the cpusets/cpuhotplug interaction is broken and removes the deadlockable code which only pretends to work.
- cpuset_lock() doesn't really work. It is needed for cpuset_cpus_allowed_locked() but we can't take this lock in try_to_wake_up()->select_fallback_rq() path.
- cpuset_lock() is deadlockable. Suppose that a task T bound to CPU takes callback_mutex. If cpu_down(CPU) happens before T drops callback_mutex stop_machine() preempts T, then migration_call(CPU_DEAD) tries to take cpuset_lock() and hangs forever because CPU is already dead and thus T can't be scheduled.
- cpuset_cpus_allowed_locked() is deadlockable too. It takes task_lock() which is not irq-safe, but try_to_wake_up() can be called from irq.
Kill them, and change select_fallback_rq() to use cpu_possible_mask, like we currently do without CONFIG_CPUSETS.
Also, with or without this patch, with or without CONFIG_CPUSETS, the callers of select_fallback_rq() can race with each other or with set_cpus_allowed() pathes.
The subsequent patches try to to fix these problems.
LKML-Reference: <[email protected]>
--- include/linux/cpuset.h | 13 ------------- kernel/cpuset.c | 27 +-------------------------- kernel/sched.c | 10 +++------- 3 files changed, 4 insertions(+), 46 deletions(-)
include/linux/cpuset.h +0 -13
@@ -21,8 +21,6 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */extern int cpuset_init (void );extern void cpuset_init_smp (void );extern void cpuset_cpus_allowed (struct task_struct *p,struct cpumask *mask); -extern void cpuset_cpus_allowed_locked (struct task_struct *p, -struct cpumask *mask);extern nodemask_t cpuset_mems_allowed (struct task_struct *p);#define cpuset_current_mems_allowed (current->mems_allowed)void cpuset_init_current_mems_allowed (void );
@@ -69,9 +67,6 @@ struct seq_file;extern void cpuset_task_status_allowed (struct seq_file *m,struct task_struct *task); -extern void cpuset_lock (void ); -extern void cpuset_unlock (void ); -extern int cpuset_mem_spread_node (void );static inline int cpuset_do_page_mem_spread (void )
@@ -105,11 +100,6 @@ static inline void cpuset_cpus_allowed(struct task_struct *p, {cpumask_copy (mask, cpu_possible_mask); } -static inline void cpuset_cpus_allowed_locked (struct task_struct *p, -struct cpumask *mask) -{ -cpumask_copy (mask, cpu_possible_mask); -}static inline nodemask_t cpuset_mems_allowed (struct task_struct *p) {
@@ -157,9 +147,6 @@ static inline void cpuset_task_status_allowed(struct seq_file *m, { } -static inline void cpuset_lock (void ) {} -static inline void cpuset_unlock (void ) {} -static inline int cpuset_mem_spread_node (void ) {return 0 ;
kernel/cpuset.c +1 -26
@@ -2182,19 +2182,10 @@ void __init cpuset_init_smp(void)void cpuset_cpus_allowed (struct task_struct *tsk,struct cpumask *pmask) {mutex_lock (&callback_mutex); -cpuset_cpus_allowed_locked (tsk, pmask); -mutex_unlock (&callback_mutex); -} - -/** -* cpuset_cpus_allowed_locked - return cpus_allowed mask from a tasks cpuset. -* Must be called with callback_mutex held. -**/ -void cpuset_cpus_allowed_locked (struct task_struct *tsk,struct cpumask *pmask) -{task_lock (tsk);guarantee_online_cpus (task_cs (tsk), pmask);task_unlock (tsk); +mutex_unlock (&callback_mutex); }void cpuset_init_current_mems_allowed (void )
@@ -2383,22 +2374,6 @@ int __cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask) }/** -* cpuset_lock - lock out any changes to cpuset structures -* -* The out of memory (oom) code needs to mutex_lock cpusets -* from being changed while it scans the tasklist looking for a -* task in an overlapping cpuset. Expose callback_mutex via this -* cpuset_lock() routine, so the oom code can lock it, before -* locking the task list. The tasklist_lock is a spinlock, so -* must be taken inside callback_mutex. -*/ - -void cpuset_lock (void ) -{ -mutex_lock (&callback_mutex); -} - -/** * cpuset_unlock - release lock on cpuset changes * * Undo the lock taken in a previous cpuset_lock() call.
kernel/sched.c +3 -7
@@ -2302,11 +2302,9 @@ static int select_fallback_rq(int cpu, struct task_struct *p)return dest_cpu;/* No more Mr. Nice Guy. */ -if (dest_cpu >= nr_cpu_ids) { -rcu_read_lock (); -cpuset_cpus_allowed_locked (p, &p->cpus_allowed); -rcu_read_unlock (); - dest_cpu =cpumask_any_and (cpu_active_mask, &p->cpus_allowed); +if (unlikely (dest_cpu >= nr_cpu_ids)) { +cpumask_copy (&p->cpus_allowed, cpu_possible_mask); + dest_cpu =cpumask_any (cpu_active_mask);/* * Don't tell them about moving exiting tasks or
@@ -5947,7 +5945,6 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)case CPU_DEAD :case CPU_DEAD_FROZEN : -cpuset_lock ();/* around calls to cpuset_cpus_allowed_lock() */ migrate_live_tasks (cpu); rq =cpu_rq (cpu);kthread_stop (rq->migration_thread);
@@ -5961,7 +5958,6 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu) rq->idle->sched_class = &idle_sched_class;migrate_dead_tasks (cpu);raw_spin_unlock_irq (&rq->lock); -cpuset_unlock ();migrate_nr_uninterruptible (rq);BUG_ON (rq->nr_running !=0 );calc_global_load_remove (rq);
Signature · 1 line
1.7.3.3
PATCH 83/260 sched: move_task_off_dead_cpu(): Take rq->lock around select_fallback_rq()
In reply to Paul GortmakerFrom: Oleg Nesterov <[email protected]>
commit 1445c08d06c5594895b4fae952ef8a457e89c390 upstream.
move_task_off_dead_cpu()->select_fallback_rq() reads/updates ->cpus_allowed lockless. We can race with set_cpus_allowed() running in parallel.
Change it to take rq->lock around select_fallback_rq(). Note that it is not trivial to move this spin_lock() into select_fallback_rq(), we must recheck the task was not migrated after we take the lock and other callers do not need this lock.
To avoid the races with other callers of select_fallback_rq() which rely on TASK_WAKING, we also check p->state != TASK_WAKING and do nothing otherwise. The owner of TASK_WAKING must update ->cpus_allowed and choose the correct CPU anyway, and the subsequent __migrate_task() is just meaningless because p->se.on_rq must be false.
Alternatively, we could change select_task_rq() to take rq->lock right after it calls sched_class->select_task_rq(), but this looks a bit ugly.
Also, change it to not assume irqs are disabled and absorb __migrate_task_irq().
LKML-Reference: <[email protected]>
--- kernel/sched.c | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-)
kernel/sched.c +15 -15
@@ -5527,29 +5527,29 @@ static int migration_thread(void *data) }#ifdef CONFIG_HOTPLUG_CPU - -static int __migrate_task_irq (struct task_struct *p,int src_cpu,int dest_cpu) -{ -int ret; - -local_irq_disable (); - ret =__migrate_task (p, src_cpu, dest_cpu); -local_irq_enable (); -return ret; -} -/* * Figure out where task on dead CPU should go, use force if necessary. */ static void move_task_off_dead_cpu (int dead_cpu,struct task_struct *p) { -int dest_cpu; - +struct rq *rq =cpu_rq (dead_cpu); +int needs_cpu,uninitialized_var (dest_cpu ); +unsigned long flags; again: - dest_cpu =select_fallback_rq (dead_cpu, p); +local_irq_save (flags); + +raw_spin_lock (&rq->lock); + needs_cpu = (task_cpu (p) == dead_cpu) && (p->state !=TASK_WAKING ); +if (needs_cpu) + dest_cpu =select_fallback_rq (dead_cpu, p); +raw_spin_unlock (&rq->lock);/* It can have affinity changed while we were choosing. */ -if (unlikely (!__migrate_task_irq (p, dead_cpu, dest_cpu))) +if (needs_cpu) + needs_cpu = !__migrate_task (p, dead_cpu, dest_cpu); +local_irq_restore (flags); + +if (unlikely (needs_cpu)) goto again; }
Signature · 1 line
1.7.3.3
PATCH 84/260 sched: move_task_off_dead_cpu(): Remove retry logic
In reply to Paul GortmakerFrom: Oleg Nesterov <[email protected]>
commit c1804d547dc098363443667609c272d1e4d15ee8 upstream.
The previous patch preserved the retry logic, but it looks unneeded.
__migrate_task() can only fail if we raced with migration after we dropped the lock, but in this case the caller of set_cpus_allowed/etc must initiate migration itself if ->on_rq == T.
We already fixed p->cpus_allowed, the changes in active/online masks must be visible to racer, it should migrate the task to online cpu correctly.
LKML-Reference: <[email protected]>
--- kernel/sched.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-)
kernel/sched.c +6 -7
@@ -5535,7 +5535,7 @@ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)struct rq *rq =cpu_rq (dead_cpu);int needs_cpu,uninitialized_var (dest_cpu );unsigned long flags; -again: +local_irq_save (flags);raw_spin_lock (&rq->lock);
@@ -5543,14 +5543,13 @@ again:if (needs_cpu) dest_cpu =select_fallback_rq (dead_cpu, p);raw_spin_unlock (&rq->lock); - -/* It can have affinity changed while we were choosing. */ +/* +* It can only fail if we race with set_cpus_allowed(), +* in the racer should migrate the task anyway. +*/ if (needs_cpu) - needs_cpu = !__migrate_task (p, dead_cpu, dest_cpu); +__migrate_task (p, dead_cpu, dest_cpu);local_irq_restore (flags); - -if (unlikely (needs_cpu)) - goto again; }/*
Signature · 1 line
1.7.3.3
PATCH 85/260 sched: sched_exec(): Remove the select_fallback_rq() logic
In reply to Paul GortmakerFrom: Oleg Nesterov <[email protected]>
commit 30da688ef6b76e01969b00608202fff1eed2accc upstream.
sched_exec()->select_task_rq() reads/updates ->cpus_allowed lockless. This can race with other CPUs updating our ->cpus_allowed, and this looks meaningless to me.
The task is current and running, it must have online cpus in ->cpus_allowed, the fallback mode is bogus. And, if ->sched_class returns the "wrong" cpu, this likely means we raced with set_cpus_allowed() which was called for reason, why should sched_exec() retry and call ->select_task_rq() again?
Change the code to call sched_class->select_task_rq() directly and do nothing if the returned cpu is wrong after re-checking under rq->lock.
Quoted 1 line
From now
task_struct->cpus_allowedis always stable underTASK_WAKING,
select_fallback_rq() is always called under rq-lock or the caller or the caller owns TASK_WAKING (select_task_rq).
LKML-Reference: <[email protected]>
--- kernel/sched.c | 25 ++++++++----------------- 1 files changed, 8 insertions(+), 17 deletions(-)
kernel/sched.c +8 -17
@@ -2286,6 +2286,9 @@ void task_oncpu_function_call(struct task_struct *p, }#ifdef CONFIG_SMP +/* +* ->cpus_allowed is protected by either TASK_WAKING or rq->lock held. +*/ static int select_fallback_rq (int cpu,struct task_struct *p) {int dest_cpu;
@@ -2322,12 +2325,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p) }/* -* Gets called from 3 sites (exec, fork, wakeup), since it is called without -* holding rq->lock we need to ensure ->cpus_allowed is stable, this is done -* by: -* -* exec: is unstable, retry loop -* fork & wake-up: serialize ->cpus_allowed against TASK_WAKING +* The caller (fork, wakeup) owns TASK_WAKING, ->cpus_allowed is stable. */ static inline int select_task_rq (struct task_struct *p,int sd_flags,int wake_flags)
@@ -3137,9 +3135,8 @@ void sched_exec(void)unsigned long flags;struct rq *rq; -again: this_cpu =get_cpu (); - dest_cpu =select_task_rq (p,SD_BALANCE_EXEC ,0 ); + dest_cpu = p->sched_class->select_task_rq (p,SD_BALANCE_EXEC ,0 );if (dest_cpu == this_cpu) {put_cpu ();return ;
@@ -3147,18 +3144,12 @@ again: rq =task_rq_lock (p, &flags);put_cpu (); -/* * select_task_rq() can race against ->cpus_allowed */ -if (!cpumask_test_cpu (dest_cpu, &p->cpus_allowed) - ||unlikely (!cpu_active (dest_cpu))) { -task_rq_unlock (rq, &flags); - goto again; - } - -/* force the process onto the specified CPU */ -if (migrate_task (p, dest_cpu, &req)) { +if (cpumask_test_cpu (dest_cpu, &p->cpus_allowed) && +likely (cpu_active (dest_cpu)) && +migrate_task (p, dest_cpu, &req)) {/* Need to wait for migration thread (might exit: take ref). */ struct task_struct *mt = rq->migration_thread;
Signature · 1 line
1.7.3.3
PATCH 86/260 sched: _cpu_down(): Don't play with current->cpus_allowed
In reply to Paul GortmakerFrom: Oleg Nesterov <[email protected]>
commit 6a1bdc1b577ebcb65f6603c57f8347309bc4ab13 upstream.
_cpu_down() changes the current task's affinity and then recovers it at the end. The problems are well known: we can't restore old_allowed if it was bound to the now-dead-cpu, and we can race with the userspace which can change cpu-affinity during unplug.
_cpu_down() should not play with current->cpus_allowed at all. Instead, take_cpu_down() can migrate the caller of _cpu_down() after __cpu_disable() removes the dying cpu from cpu_online_mask.
LKML-Reference: <[email protected]>
--- include/linux/sched.h | 1 + kernel/cpu.c | 18 ++++++------------ kernel/sched.c | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-)
include/linux/sched.h +1 -0
@@ -1846,6 +1846,7 @@ extern void sched_clock_idle_sleep_event(void);extern void sched_clock_idle_wakeup_event (u64 delta_ns);#ifdef CONFIG_HOTPLUG_CPU +extern void move_task_off_dead_cpu (int dead_cpu,struct task_struct *p);extern void idle_task_exit (void );#else static inline void idle_task_exit (void ) {}
kernel/cpu.c +6 -12
@@ -164,6 +164,7 @@ static inline void check_for_tasks(int cpu) }struct take_cpu_down_param { +struct task_struct *caller;unsigned long mod;void *hcpu; };
@@ -172,6 +173,7 @@ struct take_cpu_down_param {static int __ref take_cpu_down (void *_param) {struct take_cpu_down_param *param = _param; +unsigned int cpu = (unsigned long )param->hcpu;int err;/* Ensure this CPU doesn't handle any more interrupts. */
@@ -182,6 +184,8 @@ static int __ref take_cpu_down(void *_param)raw_notifier_call_chain (&cpu_chain,CPU_DYING | param->mod, param->hcpu); +if (task_cpu (param->caller) == cpu) +move_task_off_dead_cpu (cpu, param->caller);/* Force idle task to run as soon as we yield: it should immediately notice cpu is offline and die quickly. */ sched_idle_next ();
@@ -192,10 +196,10 @@ static int __ref take_cpu_down(void *_param)static int __ref _cpu_down (unsigned int cpu,int tasks_frozen) {int err, nr_calls =0 ; -cpumask_var_t old_allowed;void *hcpu = (void *)(long )cpu;unsigned long mod = tasks_frozen ?CPU_TASKS_FROZEN :0 ;struct take_cpu_down_param tcd_param = { + .caller = current, .mod = mod, .hcpu = hcpu, };
@@ -206,9 +210,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)if (!cpu_online (cpu))return -EINVAL ; -if (!alloc_cpumask_var (&old_allowed,GFP_KERNEL )) -return -ENOMEM ; -cpu_hotplug_begin ();set_cpu_active (cpu, false); err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod,
@@ -225,10 +226,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) goto out_release; } -/* Ensure that we are not runnable on dying cpu */ -cpumask_copy (old_allowed, ¤t->cpus_allowed); -set_cpus_allowed_ptr (current, cpu_active_mask); - err =__stop_machine (take_cpu_down, &tcd_param,cpumask_of (cpu));if (err) {set_cpu_active (cpu, true);
@@ -237,7 +234,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) hcpu) == NOTIFY_BAD)BUG (); - goto out_allowed; + goto out_release; }BUG_ON (cpu_online (cpu));
@@ -255,8 +252,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)check_for_tasks (cpu); -out_allowed: -set_cpus_allowed_ptr (current, old_allowed); out_release:cpu_hotplug_done ();if (!err) {
@@ -264,7 +259,6 @@ out_release: hcpu) == NOTIFY_BAD)BUG (); } -free_cpumask_var (old_allowed);return err; }
kernel/sched.c +1 -1
@@ -5521,7 +5521,7 @@ static int migration_thread(void *data)/* * Figure out where task on dead CPU should go, use force if necessary. */ -static void move_task_off_dead_cpu (int dead_cpu,struct task_struct *p) +void move_task_off_dead_cpu (int dead_cpu,struct task_struct *p) {struct rq *rq =cpu_rq (dead_cpu);int needs_cpu,uninitialized_var (dest_cpu );
Signature · 1 line
1.7.3.3
PATCH 87/260 sched: Make select_fallback_rq() cpuset friendly
In reply to Paul GortmakerFrom: Oleg Nesterov <[email protected]>
commit 9084bb8246ea935b98320554229e2f371f7f52fa upstream.
Introduce cpuset_cpus_allowed_fallback() helper to fix the cpuset problems with select_fallback_rq(). It can be called from any context and can't use any cpuset locks including task_lock(). It is called when the task doesn't have online cpus in ->cpus_allowed but ttwu/etc must be able to find a suitable cpu.
I am not proud of this patch. Everything which needs such a fat comment can't be good even if correct. But I'd prefer to not change the locking rules in the code I hardly understand, and in any case I believe this simple change make the code much more correct compared to deadlocks we currently have.
LKML-Reference: <[email protected]>
--- include/linux/cpuset.h | 7 +++++++ kernel/cpuset.c | 42 ++++++++++++++++++++++++++++++++++++++++++ kernel/sched.c | 4 +--- 3 files changed, 50 insertions(+), 3 deletions(-)
include/linux/cpuset.h +7 -0
@@ -21,6 +21,7 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */extern int cpuset_init (void );extern void cpuset_init_smp (void );extern void cpuset_cpus_allowed (struct task_struct *p,struct cpumask *mask); +extern int cpuset_cpus_allowed_fallback (struct task_struct *p);extern nodemask_t cpuset_mems_allowed (struct task_struct *p);#define cpuset_current_mems_allowed (current->mems_allowed)void cpuset_init_current_mems_allowed (void );
@@ -101,6 +102,12 @@ static inline void cpuset_cpus_allowed(struct task_struct *p,cpumask_copy (mask, cpu_possible_mask); } +static inline int cpuset_cpus_allowed_fallback (struct task_struct *p) +{ +cpumask_copy (&p->cpus_allowed, cpu_possible_mask); +return cpumask_any (cpu_active_mask); +} +static inline nodemask_t cpuset_mems_allowed (struct task_struct *p) {return node_possible_map;
kernel/cpuset.c +42 -0
48 lines not on this page · raw message
kernel/sched.c +1 -3
@@ -2306,9 +2306,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)/* No more Mr. Nice Guy. */ if (unlikely (dest_cpu >= nr_cpu_ids)) { -cpumask_copy (&p->cpus_allowed, cpu_possible_mask); - dest_cpu =cpumask_any (cpu_active_mask); - + dest_cpu =cpuset_cpus_allowed_fallback (p);/* * Don't tell them about moving exiting tasks or * kernel threads (both mm NULL), since they never
Signature · 1 line
1.7.3.3
PATCH 88/260 sched: Fix TASK_WAKING vs fork deadlock
In reply to Paul GortmakerFrom: Peter Zijlstra <[email protected]>
commit 0017d735092844118bef006696a750a0e4ef6ebd upstream.
Oleg noticed a few races with the TASK_WAKING usage on fork.
- since TASK_WAKING is basically a spinlock, it should be IRQ safe
- since we set TASK_WAKING (*) without holding rq->lock it could be there still is a rq->lock holder, thereby not actually providing full serialization.
(*) in fact we clear PF_STARTING, which in effect enables TASK_WAKING.
Cure the second issue by not setting TASK_WAKING in sched_fork(), but only temporarily in wake_up_new_task() while calling select_task_rq().
Cure the first by holding rq->lock around the select_task_rq() call, this will disable IRQs, this however requires that we push down the rq->lock release into select_task_rq_fair()'s cgroup stuff.
Because select_task_rq_fair() still needs to drop the rq->lock we cannot fully get rid of TASK_WAKING.
LKML-Reference: <new-submission>
--- include/linux/sched.h | 3 +- kernel/sched.c | 65 +++++++++++++++++----------------------------- kernel/sched_fair.c | 8 ++++- kernel/sched_idletask.c | 3 +- kernel/sched_rt.c | 5 +-- 5 files changed, 36 insertions(+), 48 deletions(-)
include/linux/sched.h +2 -1
@@ -1040,7 +1040,8 @@ struct sched_class {void (*put_prev_task) (struct rq *rq,struct task_struct *p);#ifdef CONFIG_SMP -int (*select_task_rq)(struct task_struct *p,int sd_flag,int flags); +int (*select_task_rq)(struct rq *rq,struct task_struct *p, +int sd_flag,int flags);void (*pre_schedule) (struct rq *this_rq,struct task_struct *task);void (*post_schedule) (struct rq *this_rq);
kernel/sched.c +24 -41
128 lines not on this page · raw message
kernel/sched_fair.c +6 -2
@@ -1445,7 +1445,8 @@ select_idle_sibling(struct task_struct *p, struct sched_domain *sd, int target)* * preempt must be disabled. */ -static int select_task_rq_fair (struct task_struct *p,int sd_flag,int wake_flags) +static int +select_task_rq_fair (struct rq *rq,struct task_struct *p,int sd_flag,int wake_flags) {struct sched_domain *tmp, *affine_sd =NULL , *sd =NULL ;int cpu =smp_processor_id ();
@@ -1541,8 +1542,11 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag cpumask_weight(sched_domain_span(sd)))) tmp = affine_sd; -if (tmp) +if (tmp) { +raw_spin_unlock (&rq->lock);update_shares (tmp); +raw_spin_lock (&rq->lock); + } }if (affine_sd &&wake_affine (affine_sd, p, sync))
kernel/sched_idletask.c +2 -1
@@ -6,7 +6,8 @@*/ #ifdef CONFIG_SMP -static int select_task_rq_idle (struct task_struct *p,int sd_flag,int flags) +static int +select_task_rq_idle (struct rq *rq,struct task_struct *p,int sd_flag,int flags) {return task_cpu (p);/* IDLE tasks as never migrated */ }
kernel/sched_rt.c +2 -3
@@ -948,10 +948,9 @@ static void yield_task_rt(struct rq *rq)#ifdef CONFIG_SMP static int find_lowest_rq (struct task_struct *task); -static int select_task_rq_rt (struct task_struct *p,int sd_flag,int flags) +static int +select_task_rq_rt (struct rq *rq,struct task_struct *p,int sd_flag,int flags) { -struct rq *rq =task_rq (p); -if (sd_flag !=SD_BALANCE_WAKE )return smp_processor_id ();
Signature · 1 line
1.7.3.3
PATCH 89/260 sched: Optimize task_rq_lock()
In reply to Paul GortmakerFrom: Peter Zijlstra <[email protected]>
commit 65cc8e4859ff29a9ddc989c88557d6059834c2a2 upstream.
Now that we hold the rq->lock over set_task_cpu() again, we can do away with most of the TASK_WAKING checks and reduce them again to set_cpus_allowed_ptr().
Removes some conditionals from scheduling hot-paths.
LKML-Reference: <new-submission>
--- kernel/sched.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-)
kernel/sched.c +15 -8
@@ -914,8 +914,8 @@ static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)#endif /* __ARCH_WANT_UNLOCKED_CTXSW */ /* -* Check whether the task is waking, we use this to synchronize against -* ttwu() so that task_cpu() reports a stable number. +* Check whether the task is waking, we use this to synchronize ->cpus_allowed +* against ttwu(). */ static inline int task_is_waking (struct task_struct *p) {
@@ -932,11 +932,9 @@ static inline struct rq *__task_rq_lock(struct task_struct *p)struct rq *rq;for (;;) { -while (task_is_waking (p)) -cpu_relax (); rq =task_rq (p);raw_spin_lock (&rq->lock); -if (likely (rq ==task_rq (p) && !task_is_waking (p))) +if (likely (rq ==task_rq (p)))return rq;raw_spin_unlock (&rq->lock); }
@@ -953,12 +951,10 @@ static struct rq *task_rq_lock(struct task_struct *p, unsigned long *flags)struct rq *rq;for (;;) { -while (task_is_waking (p)) -cpu_relax ();local_irq_save (*flags); rq =task_rq (p);raw_spin_lock (&rq->lock); -if (likely (rq ==task_rq (p) && !task_is_waking (p))) +if (likely (rq ==task_rq (p)))return rq;raw_spin_unlock_irqrestore (&rq->lock, *flags); }
@@ -5341,7 +5337,18 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)struct rq *rq;int ret =0 ; +/* +* Serialize against TASK_WAKING so that ttwu() and wunt() can +* drop the rq->lock and still rely on ->cpus_allowed. +*/ +again: +while (task_is_waking (p)) +cpu_relax (); rq =task_rq_lock (p, &flags); +if (task_is_waking (p)) { +task_rq_unlock (rq, &flags); + goto again; + }if (!cpumask_intersects (new_mask, cpu_active_mask)) { ret = -EINVAL ;
Signature · 1 line
1.7.3.3
PATCH 90/260 sched: Fix nr_uninterruptible count
In reply to Paul GortmakerFrom: Peter Zijlstra <[email protected]>
commit cc87f76a601d2d256118f7bab15e35254356ae21 upstream.
The cpuload calculation in calc_load_account_active() assumes rq->nr_uninterruptible will not change on an offline cpu after migrate_nr_uninterruptible(). However the recent migrate on wakeup changes broke that and would result in decrementing the offline cpu's rq->nr_uninterruptible.
Fix this by accounting the nr_uninterruptible on the waking cpu.
LKML-Reference: <new-submission>
--- kernel/sched.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
kernel/sched.c +6 -2
@@ -2388,8 +2388,12 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,* * First fix up the nr_uninterruptible count: */ -if (task_contributes_to_load (p)) - rq->nr_uninterruptible--; +if (task_contributes_to_load (p)) { +if (likely (cpu_online (orig_cpu))) + rq->nr_uninterruptible--; +else +this_rq ()->nr_uninterruptible--; + } p->state =TASK_WAKING ;if (p->sched_class->task_waking)
Signature · 1 line
1.7.3.3
PATCH 91/260 sched: Fix rq->clock synchronization when migrating tasks
In reply to Paul GortmakerFrom: Peter Zijlstra <[email protected]>
commit 861d034ee814917a83bd5de4b26e3b8336ddeeb8 upstream.
sched_fork() -- we do task placement in ->task_fork_fair() ensure we
update_rq_clock() so we work with current time. We leave the vruntime in relative state, so the time delay until wake_up_new_task() doesn't matter.
wake_up_new_task() -- Since task_fork_fair() left p->vruntime in
relative state we can safely migrate, the activate_task() on the remote rq will call update_rq_clock() and causes the clock to be synced (enough).
LKML-Reference: <1281002322.1923.1708.camel@laptop>
--- kernel/sched_fair.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/sched_fair.c +2 -0
@@ -3588,6 +3588,8 @@ static void task_fork_fair(struct task_struct *p)raw_spin_lock_irqsave (&rq->lock, flags); +update_rq_clock (rq); +if (unlikely (task_cpu (p) != this_cpu))__set_task_cpu (p, this_cpu);
Signature · 1 line
1.7.3.3
PATCH 92/260 rcu: apply RCU protection to wake_affine()
In reply to Paul GortmakerFrom: Daniel J Blueman <[email protected]>
commit f3b577dec1f2ce32d2db6d2ca6badff7002512af upstream.
The task_group() function returns a pointer that must be protected by either RCU, the ->alloc_lock, or the cgroup lock (see the rcu_dereference_check() in task_subsys_state(), which is invoked by task_group()). The wake_affine() function currently does none of these, which means that a concurrent update would be within its rights to free the structure returned by task_group(). Because wake_affine() uses this structure only to compute load-balancing heuristics, there is no reason to acquire either of the two locks.
Therefore, this commit introduces an RCU read-side critical section that starts before the first call to task_group() and ends after the last use of the "tg" pointer returned from task_group(). Thanks to Li Zefan for pointing out the need to extend the RCU read-side critical section from that proposed by the original patch.
--- kernel/sched_fair.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/sched_fair.c +2 -0
@@ -1272,6 +1272,7 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)* effect of the currently running task from the load * of the current CPU: */ +rcu_read_lock ();if (sync) { tg =task_group (current); weight = current->se.load.weight;
@@ -1297,6 +1298,7 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) balanced = !this_load ||100 *(this_load +effective_load (tg, this_cpu, weight, weight)) <= imbalance*(load +effective_load (tg, prev_cpu,0 , weight)); +rcu_read_unlock ();/* * If the currently running task will sleep within
Signature · 1 line
1.7.3.3
PATCH 93/260 sched: Fix select_idle_sibling()
In reply to Paul GortmakerFrom: Mike Galbraith <[email protected]>
commit 8b911acdf08477c059d1c36c21113ab1696c612b upstream.
Don't bother with selection when the current cpu is idle. Recent load balancing changes also make it no longer necessary to check wake_affine() success before returning the selected sibling, so we now always use it.
LKML-Reference: <[email protected]>
--- kernel/sched_fair.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)
kernel/sched_fair.c +10 -4
@@ -1454,7 +1454,7 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_int cpu =smp_processor_id ();int prev_cpu =task_cpu (p);int new_cpu = cpu; -int want_affine =0 ; +int want_affine =0 , cpu_idle = !current->pid;int want_sd =1 ;int sync = wake_flags &WF_SYNC ;
@@ -1512,13 +1512,15 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_* If there's an idle sibling in this domain, make that * the wake_affine target instead of the current cpu. */ -if (tmp->flags &SD_SHARE_PKG_RESOURCES ) +if (!cpu_idle && tmp->flags &SD_SHARE_PKG_RESOURCES ) target =select_idle_sibling (p, tmp, target);if (target >=0 ) {if (tmp->flags &SD_WAKE_AFFINE ) { affine_sd = tmp; want_affine =0 ; +if (target != cpu) + cpu_idle =1 ; } cpu = target; }
@@ -1534,6 +1536,7 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_ sd = tmp; } +#ifdef CONFIG_FAIR_GROUP_SCHED if (sched_feat (LB_SHARES_UPDATE )) {/* * Pick the largest domain to update shares over
@@ -1550,9 +1553,12 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_ raw_spin_lock(&rq->lock); } } +#endif -if (affine_sd &&wake_affine (affine_sd, p, sync)) -return cpu; +if (affine_sd) { +if (cpu_idle || cpu == prev_cpu ||wake_affine (affine_sd, p, sync)) +return cpu; + }while (sd) {int load_idx = sd->forkexec_idx;
Signature · 1 line
1.7.3.3
PATCH 94/260 sched: Pre-compute cpumask_weight(sched_domain_span(sd))
In reply to Paul GortmakerFrom: Peter Zijlstra <[email protected]>
commit 669c55e9f99b90e46eaa0f98a67ec53d46dc969a upstream.
Dave reported that his large SPARC machines spend lots of time in hweight64(), try and optimize some of those needless cpumask_weight() invocations (esp. with the large offstack cpumasks these are very expensive indeed).
LKML-Reference: <new-submission>
--- include/linux/sched.h | 1 + kernel/sched.c | 3 +++ kernel/sched_fair.c | 12 +++++------- 3 files changed, 9 insertions(+), 7 deletions(-)
include/linux/sched.h +1 -0
@@ -954,6 +954,7 @@ struct sched_domain {char *name;#endif +unsigned int span_weight;/* * Span of all CPUs in this domain. *
kernel/sched.c +3 -0
@@ -6296,6 +6296,9 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)struct rq *rq =cpu_rq (cpu);struct sched_domain *tmp; +for (tmp = sd; tmp; tmp = tmp->parent) + tmp->span_weight =cpumask_weight (sched_domain_span (tmp)); +/* Remove the sched domains which do not contribute to scheduling. */ for (tmp = sd; tmp; ) {struct sched_domain *parent = tmp->parent;
kernel/sched_fair.c +5 -7
@@ -1542,9 +1542,7 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_* Pick the largest domain to update shares over */ tmp = sd; -if (affine_sd && (!tmp || -cpumask_weight (sched_domain_span (affine_sd)) > -cpumask_weight (sched_domain_span (sd)))) +if (affine_sd && (!tmp || affine_sd->span_weight > sd->span_weight)) tmp = affine_sd;if (tmp) {
@@ -1588,10 +1586,10 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_/* Now try balancing at a lower domain level of new_cpu */ cpu = new_cpu; - weight =cpumask_weight (sched_domain_span (sd)); + weight = sd->span_weight; sd =NULL ;for_each_domain (cpu, tmp) { -if (weight <=cpumask_weight (sched_domain_span (tmp))) +if (weight <= tmp->span_weight)break ;if (tmp->flags & sd_flag) sd = tmp;
@@ -2323,7 +2321,7 @@ unsigned long __weak arch_scale_freq_power(struct sched_domain *sd, int cpu)unsigned long default_scale_smt_power (struct sched_domain *sd,int cpu) { -unsigned long weight =cpumask_weight (sched_domain_span (sd)); +unsigned long weight = sd->span_weight;unsigned long smt_gain = sd->smt_gain; smt_gain /= weight;
@@ -2356,7 +2354,7 @@ unsigned long scale_rt_power(int cpu)static void update_cpu_power (struct sched_domain *sd,int cpu) { -unsigned long weight =cpumask_weight (sched_domain_span (sd)); +unsigned long weight = sd->span_weight;unsigned long power =SCHED_LOAD_SCALE ;struct sched_group *sdg = sd->groups;
Signature · 1 line
1.7.3.3
PATCH 95/260 sched: Fix select_idle_sibling() logic in select_task_rq_fair()
In reply to Paul GortmakerFrom: Suresh Siddha <[email protected]>
commit 99bd5e2f245d8cd17d040c82d40becdb3efd9b69 upstream.
Issues in the current select_idle_sibling() logic in select_task_rq_fair() in the context of a task wake-up:
a) Once we select the idle sibling, we use that domain (spanning the cpu that the task is currently woken-up and the idle sibling that we found) in our wake_affine() decisions. This domain is completely different from the domain(we are supposed to use) that spans the cpu that the task currently woken-up and the cpu where the task previously ran.
b) We do select_idle_sibling() check only for the cpu that the task is currently woken-up on. If select_task_rq_fair() selects the previously run cpu for waking the task, doing a select_idle_sibling() check for that cpu also helps and we don't do this currently.
c) In the scenarios where the cpu that the task is woken-up is busy but with its HT siblings are idle, we are selecting the task be woken-up on the idle HT sibling instead of a core that it previously ran and currently completely idle. i.e., we are not taking decisions based on wake_affine() but directly selecting an idle sibling that can cause an imbalance at the SMT/MC level which will be later corrected by the periodic load balancer.
Fix this by first going through the load imbalance calculations using wake_affine() and once we make a decision of woken-up cpu vs previously-ran cpu, then choose a possible idle sibling for waking up the task on.
LKML-Reference: <[email protected]>
--- kernel/sched_fair.c | 82 +++++++++++++++++++++++++-------------------------- 1 files changed, 40 insertions(+), 42 deletions(-)
kernel/sched_fair.c +40 -42
@@ -1408,29 +1408,48 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)/* * Try and locate an idle CPU in the sched_domain. */ -static int -select_idle_sibling (struct task_struct *p,struct sched_domain *sd,int target) +static int select_idle_sibling (struct task_struct *p,int target) {int cpu =smp_processor_id ();int prev_cpu =task_cpu (p); +struct sched_domain *sd;int i;/* -* If this domain spans both cpu and prev_cpu (see the SD_WAKE_AFFINE -* test in select_task_rq_fair) and the prev_cpu is idle then that's -* always a better target than the current cpu. +* If the task is going to be woken-up on this cpu and if it is +* already idle, then it is the right target. +*/ +if (target == cpu &&idle_cpu (cpu)) +return cpu; + +/* +* If the task is going to be woken-up on the cpu where it previously +* ran and if it is currently idle, then it the right target. */ -if (target == cpu && !cpu_rq (prev_cpu)->cfs.nr_running) +if (target == prev_cpu &&idle_cpu (prev_cpu))return prev_cpu;/* -* Otherwise, iterate the domain and find an elegible idle cpu. +* Otherwise, iterate the domains and find an elegible idle cpu. */ -for_each_cpu_and (i,sched_domain_span (sd), &p->cpus_allowed) { -if (!cpu_rq (i)->cfs.nr_running) { - target = i; +for_each_domain (target, sd) { +if (!(sd->flags &SD_SHARE_PKG_RESOURCES ))break ; + +for_each_cpu_and (i,sched_domain_span (sd), &p->cpus_allowed) { +if (idle_cpu (i)) { + target = i; +break ; + } } + +/* +* Lets stop looking for an idle sibling when we reached +* the domain that spans the current cpu and prev_cpu. +*/ +if (cpumask_test_cpu (cpu,sched_domain_span (sd)) && +cpumask_test_cpu (prev_cpu,sched_domain_span (sd))) +break ; }return target;
@@ -1454,7 +1473,7 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_int cpu =smp_processor_id ();int prev_cpu =task_cpu (p);int new_cpu = cpu; -int want_affine =0 , cpu_idle = !current->pid; +int want_affine =0 ;int want_sd =1 ;int sync = wake_flags &WF_SYNC ;
@@ -1494,36 +1513,13 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_ }/* -* While iterating the domains looking for a spanning -* WAKE_AFFINE domain, adjust the affine target to any idle cpu -* in cache sharing domains along the way. +* If both cpu and prev_cpu are part of this domain, +* cpu is a valid SD_WAKE_AFFINE target. */ -if (want_affine) { -int target =-1 ; - -/* -* If both cpu and prev_cpu are part of this domain, -* cpu is a valid SD_WAKE_AFFINE target. -*/ -if (cpumask_test_cpu (prev_cpu,sched_domain_span (tmp))) - target = cpu; - -/* -* If there's an idle sibling in this domain, make that -* the wake_affine target instead of the current cpu. -*/ -if (!cpu_idle && tmp->flags &SD_SHARE_PKG_RESOURCES ) - target =select_idle_sibling (p, tmp, target); - -if (target >=0 ) { -if (tmp->flags &SD_WAKE_AFFINE ) { - affine_sd = tmp; - want_affine =0 ; -if (target != cpu) - cpu_idle =1 ; - } - cpu = target; - } +if (want_affine && (tmp->flags &SD_WAKE_AFFINE ) && +cpumask_test_cpu (prev_cpu,sched_domain_span (tmp))) { + affine_sd = tmp; + want_affine =0 ; }if (!want_sd && !want_affine)
@@ -1554,8 +1550,10 @@ select_task_rq_fair(struct rq *rq, struct task_struct *p, int sd_flag, int wake_#endif if (affine_sd) { -if (cpu_idle || cpu == prev_cpu ||wake_affine (affine_sd, p, sync)) -return cpu; +if (cpu == prev_cpu ||wake_affine (affine_sd, p, sync)) +return select_idle_sibling (p, cpu); +else +return select_idle_sibling (p, prev_cpu); }while (sd) {
Signature · 1 line
1.7.3.3
PATCH 96/260 ALSA: hda - Handle missing NID 0x1b on ALC259 codec
In reply to Paul GortmakerFrom: Takashi Iwai <[email protected]>
commit 5d4abf93ea3192cc666430225a29a4978c97c57d upstream.
Since ALC259/269 use the same parser of ALC268, the pin 0x1b was ignored as an invalid widget. Just add this NID to handle properly. This will add the missing mixer controls for some devices.
--- sound/pci/hda/patch_realtek.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
sound/pci/hda/patch_realtek.c +1 -0
@@ -12911,6 +12911,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, dac =0x02 ;break ;case 0x15 : +case 0x1b :case 0x21 :/* ALC269vb has this pin, too */ dac =0x03 ;break ;
Signature · 1 line
1.7.3.3
PATCH 97/260 ALSA: hda - Handle pin NID 0x1a on ALC259/269
In reply to Paul GortmakerFrom: Takashi Iwai <[email protected]>
commit b08b1637ce1c0196970348bcabf40f04b6b3d58e upstream.
The pin NID 0x1a should be handled as well as NID 0x1b. Also added comments.
--- sound/pci/hda/patch_realtek.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
sound/pci/hda/patch_realtek.c +2 -1
@@ -12911,7 +12911,8 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, dac =0x02 ;break ;case 0x15 : -case 0x1b : +case 0x1a :/* ALC259/269 only */ +case 0x1b :/* ALC259/269 only */ case 0x21 :/* ALC269vb has this pin, too */ dac =0x03 ;break ;
Signature · 1 line
1.7.3.3
PATCH 98/260 arm: fix really nasty sigreturn bug
In reply to Paul GortmakerFrom: Al Viro <[email protected]>
commit 653d48b22166db2d8b1515ebe6f9f0f7c95dfc86 upstream.
If a signal hits us outside of a syscall and another gets delivered when we are in sigreturn (e.g. because it had been in sa_mask for the first one and got sent to us while we'd been in the first handler), we have a chance of returning from the second handler to location one insn prior to where we ought to return. If r0 happens to contain -513 (-ERESTARTNOINTR), sigreturn will get confused into doing restart syscall song and dance.
Incredible joy to debug, since it manifests as random, infrequent and very hard to reproduce double execution of instructions in userland code...
The fix is simple - mark it "don't bother with restarts" in wrapper, i.e. set r8 to 0 in sys_sigreturn and sys_rt_sigreturn wrappers, suppressing the syscall restart handling on return from these guys. They can't legitimately return a restart-worthy error anyway.
Testcase:
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/time.h>
#include <errno.h>
void f(int n)
{
__asm__ __volatile__(
"ldr r0, [%0]\n"
"b 1f\n"
"b 2f\n"
"1:b .\n"
"2:\n" : : "r"(&n));
}
void handler1(int sig) { }
void handler2(int sig) { raise(1); }
void handler3(int sig) { exit(0); }
main()
{
struct sigaction s = {.sa_handler = handler2};
struct itimerval t1 = { .it_value = {1} };
struct itimerval t2 = { .it_value = {2} };
signal(1, handler1);
sigemptyset(&s.sa_mask);
sigaddset(&s.sa_mask, 1);
sigaction(SIGALRM, &s, NULL);
signal(SIGVTALRM, handler3);
setitimer(ITIMER_REAL, &t1, NULL);
setitimer(ITIMER_VIRTUAL, &t2, NULL);
f(-513); /* -ERESTARTNOINTR */
write(1, "buggered\n", 9);
return 1;
}--- arch/arm/kernel/entry-common.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/kernel/entry-common.S +2 -0
@@ -382,11 +382,13 @@ ENDPROC(sys_clone_wrapper) sys_sigreturn_wrapper: add r0, sp, #S_OFF + mov why, #0 @ prevent syscall restart handling b sys_sigreturn ENDPROC(sys_sigreturn_wrapper) sys_rt_sigreturn_wrapper: add r0, sp, #S_OFF + mov why, #0 @ prevent syscall restart handling b sys_rt_sigreturn ENDPROC(sys_rt_sigreturn_wrapper)
Signature · 1 line
1.7.3.3
PATCH 99/260 hwmon: (f75375s) Shift control mode to the correct bit position
In reply to Paul GortmakerFrom: Guillem Jover <[email protected]>
commit 96f3640894012be7dd15a384566bfdc18297bc6c upstream.
The spec notes that fan0 and fan1 control mode bits are located in bits 7-6 and 5-4 respectively, but the FAN_CTRL_MODE macro was making the bits shift by 5 instead of by 4.
--- drivers/hwmon/f75375s.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/f75375s.c +1 -1
@@ -79,7 +79,7 @@ enum chips { f75373, f75375 };#define F75375_REG_PWM2_DROP_DUTY 0x6C#define FAN_CTRL_LINEAR (nr) (4 + nr) -#define FAN_CTRL_MODE (nr) (5 + ((nr) * 2)) +#define FAN_CTRL_MODE (nr) (4 + ((nr) * 2))/* * Data structures and manipulation thereof
Signature · 1 line
1.7.3.3
PATCH 100/260 hwmon: (f75375s) Do not overwrite values read from registers
In reply to Paul GortmakerFrom: Guillem Jover <[email protected]>
commit c3b327d60bbba3f5ff8fd87d1efc0e95eb6c121b upstream.
All bits in the values read from registers to be used for the next write were getting overwritten, avoid doing so to not mess with the current configuration.
--- drivers/hwmon/f75375s.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/f75375s.c +2 -2
@@ -298,7 +298,7 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)return -EINVAL ; fanmode =f75375_read8 (client,F75375_REG_FAN_TIMER ); - fanmode = ~(3 <<FAN_CTRL_MODE (nr)); + fanmode &= ~(3 <<FAN_CTRL_MODE (nr));switch (val) {case 0 :/* Full speed */
@@ -350,7 +350,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,mutex_lock (&data->update_lock); conf =f75375_read8 (client,F75375_REG_CONFIG1 ); - conf = ~(1 <<FAN_CTRL_LINEAR (nr)); + conf &= ~(1 <<FAN_CTRL_LINEAR (nr));if (val ==0 ) conf |= (1 <<FAN_CTRL_LINEAR (nr)) ;
Signature · 1 line
1.7.3.3
PATCH 101/260 apm_power: Add missing break statement
In reply to Paul GortmakerFrom: Anton Vorontsov <[email protected]>
commit 1d220334d6a8a711149234dc5f98d34ae02226b8 upstream.
The missing break statement causes wrong capacity calculation for batteries that report energy.
--- drivers/power/apm_power.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/power/apm_power.c +1 -0
@@ -233,6 +233,7 @@ static int calculate_capacity(enum apm_source source) empty_design_prop =POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN ; now_prop =POWER_SUPPLY_PROP_ENERGY_NOW ; avg_prop =POWER_SUPPLY_PROP_ENERGY_AVG ; +break ;case SOURCE_VOLTAGE : full_prop =POWER_SUPPLY_PROP_VOLTAGE_MAX ; empty_prop =POWER_SUPPLY_PROP_VOLTAGE_MIN ;
Signature · 1 line
1.7.3.3
PATCH 102/260 NFS: Fix a typo in nfs_sockaddr_match_ipaddr6
In reply to Paul GortmakerFrom: Trond Myklebust <[email protected]>
commit b20d37ca9561711c6a3c4b859c2855f49565e061 upstream.
--- fs/nfs/client.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/client.c +1 -1
@@ -274,7 +274,7 @@ static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1, sin1->sin6_scope_id != sin2->sin6_scope_id)return 0 ; -return ipv6_addr_equal (&sin1->sin6_addr, &sin1->sin6_addr); +return ipv6_addr_equal (&sin1->sin6_addr, &sin2->sin6_addr); }#else /* !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) */ static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1,
Signature · 1 line
1.7.3.3
PATCH 103/260 SUNRPC: Fix race corrupting rpc upcall
In reply to Paul GortmakerFrom: Trond Myklebust <[email protected]>
commit 5a67657a2e90c9e4a48518f95d4ba7777aa20fbb upstream.
If rpc_queue_upcall() adds a new upcall to the rpci->pipe list just after rpc_pipe_release calls rpc_purge_list(), but before it calls gss_pipe_release (as rpci->ops->release_pipe(inode)), then the latter will free a message without deleting it from the rpci->pipe list.
We will be left with a freed object on the rpc->pipe list. Most frequent symptoms are kernel crashes in rpc.gssd system calls on the pipe in question.
--- net/sunrpc/auth_gss/auth_gss.c | 9 +++++---- net/sunrpc/rpc_pipe.c | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +5 -4
@@ -724,17 +724,18 @@ gss_pipe_release(struct inode *inode)struct rpc_inode *rpci =RPC_I (inode);struct gss_upcall_msg *gss_msg; +restart:spin_lock (&inode->i_lock); -while (!list_empty (&rpci->in_downcall)) { +list_for_each_entry (gss_msg, &rpci->in_downcall, list) { - gss_msg =list_entry (rpci->in_downcall.next, - struct gss_upcall_msg, list); +if (!list_empty (&gss_msg->msg.list)) +continue ; gss_msg->msg.errno = -EPIPE ;atomic_inc (&gss_msg->count);__gss_unhash_msg (gss_msg);spin_unlock (&inode->i_lock);gss_release_msg (gss_msg); -spin_lock (&inode->i_lock); + goto restart; }spin_unlock (&inode->i_lock);
net/sunrpc/rpc_pipe.c +3 -3
@@ -47,7 +47,7 @@ static void rpc_purge_list(struct rpc_inode *rpci, struct list_head *head,return ;do { msg = list_entry(head->next, struct rpc_pipe_msg, list); -list_del (&msg->list); +list_del_init (&msg->list); msg->errno = err;destroy_msg (msg); }while (!list_empty (head));
@@ -207,7 +207,7 @@ rpc_pipe_release(struct inode *inode, struct file *filp)if (msg !=NULL ) {spin_lock (&inode->i_lock); msg->errno = -EAGAIN ; -list_del (&msg->list); +list_del_init (&msg->list);spin_unlock (&inode->i_lock); rpci->ops->destroy_msg (msg); }
@@ -267,7 +267,7 @@ rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset)if (res <0 || msg->len == msg->copied) { filp->private_data =NULL ;spin_lock (&inode->i_lock); -list_del (&msg->list); +list_del_init (&msg->list);spin_unlock (&inode->i_lock); rpci->ops->destroy_msg (msg); }
Signature · 1 line
1.7.3.3
PATCH 104/260 i915: return -EFAULT if copy_to_user fails
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
commit 9927a403ca8c97798129953fa9cbb5dc259c7cb9 upstream.
copy_to_user returns the number of bytes remaining to be copied, but we want to return a negative error code here. These are returned to userspace.
--- drivers/gpu/drm/i915/i915_dma.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +9 -3
@@ -691,8 +691,10 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, ret =copy_from_user (cliprects, batch->cliprects, batch->num_cliprects *sizeof (struct drm_clip_rect )); -if (ret !=0 ) +if (ret !=0 ) { + ret = -EFAULT ; goto fail_free; + } }mutex_lock (&dev->struct_mutex);
@@ -733,8 +735,10 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,return -ENOMEM ; ret =copy_from_user (batch_data, cmdbuf->buf, cmdbuf->sz); -if (ret !=0 ) +if (ret !=0 ) { + ret = -EFAULT ; goto fail_batch_free; + }if (cmdbuf->num_cliprects) { cliprects = kcalloc(cmdbuf->num_cliprects,
@@ -747,8 +751,10 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, ret =copy_from_user (cliprects, cmdbuf->cliprects, cmdbuf->num_cliprects *sizeof (struct drm_clip_rect )); -if (ret !=0 ) +if (ret !=0 ) { + ret = -EFAULT ; goto fail_clip_free; + } }mutex_lock (&dev->struct_mutex);
Signature · 1 line
1.7.3.3
PATCH 105/260 i915: return -EFAULT if copy_to_user fails
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
commit c877cdce93a44eea96f6cf7fc04be7d0372db2be upstream.
copy_to_user() returns the number of bytes remaining to be copied and I'm pretty sure we want to return a negative error code here.
--- drivers/gpu/drm/i915/i915_gem.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +1 -0
@@ -3818,6 +3818,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,if (ret !=0 ) {DRM_ERROR ("copy %d cliprects failed: %d\n" , args->num_cliprects, ret); + ret = -EFAULT ; goto pre_mutex_err; } }
Signature · 1 line
1.7.3.3
PATCH 106/260 drm/i915: Prevent double dpms on
In reply to Paul GortmakerFrom: Chris Wilson <[email protected]>
commit 032d2a0d068b0368296a56469761394ef03207c3 upstream.
Arguably this is a bug in drm-core in that we should not be called twice in succession with DPMS_ON, however this is still occuring and we see FDI link training failures on the second call leading to the occassional blank display. For the time being ignore the repeated call.
Original patch by Dave Airlie <[email protected]>
--- drivers/gpu/drm/i915/intel_display.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -1
@@ -2059,6 +2059,9 @@ static void intel_crtc_dpms(struct drm_crtc *crtc, int mode)int pipe = intel_crtc->pipe;bool enabled; +if (intel_crtc->dpms_mode == mode) +return ; + dev_priv->display.dpms (crtc, mode); intel_crtc->dpms_mode = mode;
@@ -4389,7 +4392,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; intel_crtc->cursor_addr =0 ; - intel_crtc->dpms_mode =DRM_MODE_DPMS_OFF ; + intel_crtc->dpms_mode =-1 ;drm_crtc_helper_add (&intel_crtc->base, &intel_helper_funcs); intel_crtc->busy = false;
Signature · 1 line
1.7.3.3
PATCH 107/260 drm: Only decouple the old_fb from the crtc is we call mode_set*
In reply to Paul GortmakerFrom: Chris Wilson <[email protected]>
commit 356ad3cd616185631235ffb48b3efbf39f9923b3 upstream.
Otherwise when disabling the output we switch to the new fb (which is likely NULL) and skip the call to mode_set -- leaking driver private state on the old_fb.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29857
--- drivers/gpu/drm/drm_crtc_helper.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_crtc_helper.c +2 -2
@@ -921,13 +921,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) mode_changed = true;if (mode_changed) { - old_fb = set->crtc->fb; - set->crtc->fb = set->fb; set->crtc->enabled = (set->mode !=NULL );if (set->mode !=NULL ) {DRM_DEBUG_KMS ("attempting to set mode from" " userspace\n" );drm_mode_debug_printmodeline (set->mode); + old_fb = set->crtc->fb; + set->crtc->fb = set->fb;if (!drm_crtc_helper_set_mode (set->crtc, set->mode, set->x, set->y, old_fb)) {
Signature · 1 line
1.7.3.3
PATCH 108/260 tun: Don't add sysfs attributes to devices without sysfs directories
In reply to Paul GortmakerFrom: Ben Hutchings <[email protected]>
This applies to 2.6.32 *only*. It has not been applied upstream since the limitation no longer exists.
Prior to Linux 2.6.35, net devices outside the initial net namespace did not have sysfs directories. Attempting to add attributes to them will trigger a BUG().
--- drivers/net/tun.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/tun.c +2 -1
@@ -1061,7 +1061,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)if (err <0 ) goto err_free_sk; -if (device_create_file (&tun->dev->dev, &dev_attr_tun_flags) || +if (!net_eq (dev_net (tun->dev), &init_net) || +device_create_file (&tun->dev->dev, &dev_attr_tun_flags) ||device_create_file (&tun->dev->dev, &dev_attr_owner) ||device_create_file (&tun->dev->dev, &dev_attr_group))printk (KERN_ERR "Failed to create tun sysfs files\n" );
Signature · 1 line
1.7.3.3
PATCH 109/260 USB: serial/mos*: prevent reading uninitialized stack memory
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
commit a0846f1868b11cd827bdfeaf4527d8b1b1c0b098 upstream.
The TIOCGICOUNT device ioctl in both mos7720.c and mos7840.c allows unprivileged users to read uninitialized stack memory, because the "reserved" member of the serial_icounter_struct struct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/usb/serial/mos7720.c | 3 +++ drivers/usb/serial/mos7840.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/usb/serial/mos7720.c +3 -0
@@ -1566,6 +1566,9 @@ static int mos7720_ioctl(struct tty_struct *tty, struct file *file,case TIOCGICOUNT : cnow = mos7720_port->icount; + +memset (&icount,0 ,sizeof (struct serial_icounter_struct )); + icount.cts = cnow.cts; icount.dsr = cnow.dsr; icount.rng = cnow.rng;
drivers/usb/serial/mos7840.c +3 -0
@@ -2286,6 +2286,9 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file,case TIOCGICOUNT : cnow = mos7840_port->icount;smp_rmb (); + +memset (&icount,0 ,sizeof (struct serial_icounter_struct )); + icount.cts = cnow.cts; icount.dsr = cnow.dsr; icount.rng = cnow.rng;
Signature · 1 line
1.7.3.3
PATCH 110/260 gro: fix different skb headrooms
In reply to Paul GortmakerFrom: Eric Dumazet <[email protected]>
commit 3d3be4333fdf6faa080947b331a6a19bce1a4f57 upstream.
Packets entering GRO might have different headrooms, even for a given flow (because of implementation details in drivers, like copybreak). We cant force drivers to deliver packets with a fixed headroom.
1) fix skb_segment()
skb_segment() makes the false assumption headrooms of fragments are same than the head. When CHECKSUM_PARTIAL is used, this can give csum_start errors, and crash later in skb_copy_and_csum_dev()
2) allocate a minimal skb for head of frag_list
skb_gro_receive() uses netdev_alloc_skb(headroom + skb_gro_offset(p)) to allocate a fresh skb. This adds NET_SKB_PAD to a padding already provided by netdevice, depending on various things, like copybreak.
Use alloc_skb() to allocate an exact padding, to reduce cache line needs:NET_SKB_PAD + NET_IP_ALIGN
bugzilla : https://bugzilla.kernel.org/show_bug.cgi?id=16626
Many thanks to Plamen Petrov, testing many debugging patches ! With help of Jarek Poplawski.
--- net/core/skbuff.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
net/core/skbuff.c +6 -2
@@ -2578,6 +2578,10 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)__copy_skb_header (nskb, skb); nskb->mac_len = skb->mac_len; +/* nskb and skb might have different headroom */ +if (nskb->ip_summed ==CHECKSUM_PARTIAL ) + nskb->csum_start +=skb_headroom (nskb) - headroom; +skb_reset_mac_header (nskb);skb_set_network_header (nskb, skb->mac_len); nskb->transport_header = (nskb->network_header +
@@ -2707,8 +2711,8 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) }else if (skb_gro_len (p) != pinfo->gso_size)return -E2BIG ; - headroom =skb_headroom (p); - nskb =netdev_alloc_skb (p->dev, headroom +skb_gro_offset (p)); + headroom =NET_SKB_PAD +NET_IP_ALIGN ; + nskb =alloc_skb (headroom +skb_gro_offset (p),GFP_ATOMIC );if (unlikely (!nskb))return -ENOMEM ;
Signature · 1 line
1.7.3.3
PATCH 111/260 gro: Re-fix different skb headrooms
In reply to Paul GortmakerFrom: Jarek Poplawski <[email protected]>
commit 64289c8e6851bca0e589e064c9a5c9fbd6ae5dd4 upstream.
The patch: "gro: fix different skb headrooms" in its part:
"2) allocate a minimal skb for head of frag_list" is buggy. The copied skb has p->data set at the ip header at the moment, and skb_gro_offset is the length of ip + tcp headers. So, after the change the length of mac header is skipped. Later skb_set_mac_header() sets it into the NET_SKB_PAD area (if it's long enough) and ip header is misaligned at NET_SKB_PAD + NET_IP_ALIGN offset. There is no reason to assume the original skb was wrongly allocated, so let's copy it as it was.
bugzilla : https://bugzilla.kernel.org/show_bug.cgi?id=16626
fixes commit: 3d3be4333fdf6faa080947b331a6a19bce1a4f57
--- net/core/skbuff.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/core/skbuff.c +1 -1
@@ -2711,7 +2711,7 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) }else if (skb_gro_len (p) != pinfo->gso_size)return -E2BIG ; - headroom =NET_SKB_PAD +NET_IP_ALIGN ; + headroom =skb_headroom (p); nskb =alloc_skb (headroom +skb_gro_offset (p),GFP_ATOMIC );if (unlikely (!nskb))return -ENOMEM ;
Signature · 1 line
1.7.3.3
PATCH 112/260 irda: Correctly clean up self->ias_obj on irda_bind() failure.
In reply to Paul GortmakerFrom: David S. Miller <[email protected]>
commit 628e300cccaa628d8fb92aa28cb7530a3d5f2257 upstream.
If irda_open_tsap() fails, the irda_bind() code tries to destroy the ->ias_obj object by hand, but does so wrongly.
In particular, it fails to a) release the hashbin attached to the object and b) reset the self->ias_obj pointer to NULL.
Fix both problems by using irias_delete_object() and explicitly setting self->ias_obj to NULL, just as irda_release() does.
--- net/irda/af_irda.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/irda/af_irda.c +2 -2
@@ -824,8 +824,8 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) err =irda_open_tsap (self, addr->sir_lsap_sel, addr->sir_name);if (err <0 ) { -kfree (self->ias_obj->name); -kfree (self->ias_obj); +irias_delete_object (self->ias_obj); + self->ias_obj =NULL ; goto out; }
Signature · 1 line
1.7.3.3
PATCH 113/260 tcp: select(writefds) don't hang up when a peer close connection
In reply to Paul GortmakerFrom: KOSAKI Motohiro <[email protected]>
commit d84ba638e4ba3c40023ff997aa5e8d3ed002af36 upstream.
This issue come from ruby language community. Below test program hang up when only run on Linux.
% uname -mrsv
Linux 2.6.26-2-486 #1 Sat Dec 26 08:37:39 UTC 2009 i686
% ruby -rsocket -ve '
BasicSocket.do_not_reverse_lookup = true
serv = TCPServer.open("127.0.0.1", 0)
s1 = TCPSocket.open("127.0.0.1", serv.addr[1])
s2 = serv.accept
s2.close
s1.write("a") rescue p $!
s1.write("a") rescue p $!
Thread.new {
s1.write("a")
}.join'
ruby 1.9.3dev (2010-07-06 trunk 28554) [i686-linux]
#<Errno::EPIPE: Broken pipe>
[Hang Here]FreeBSD, Solaris, Mac doesn't. because Ruby's write() method call select() internally. and tcp_poll has a bug.
SUS defined 'ready for writing' of select() as following.
| A descriptor shall be considered ready for writing when a call to an output | function with O_NONBLOCK clear would not block, whether or not the function | would transfer data successfully.
That said, EPIPE situation is clearly one of 'ready for writing'.
We don't have read-side issue because tcp_poll() already has read side shutdown care.
| if (sk->sk_shutdown & RCV_SHUTDOWN)
| mask |= POLLIN | POLLRDNORM | POLLRDHUP;
So, Let's insert same logic in write side.
- reference url
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/31065
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/31068
--- net/ipv4/tcp.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/ipv4/tcp.c +2 -1
@@ -453,7 +453,8 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)if (sk_stream_wspace (sk) >=sk_stream_min_wspace (sk)) mask |=POLLOUT |POLLWRNORM ; } - } + }else + mask |=POLLOUT |POLLWRNORM ;if (tp->urg_data &TCP_URG_VALID ) mask |=POLLPRI ;
Signature · 1 line
1.7.3.3
PATCH 114/260 tcp: Combat per-cpu skew in orphan tests.
In reply to Paul GortmakerFrom: David S. Miller <[email protected]>
commit ad1af0fedba14f82b240a03fe20eb9b2fdbd0357 upstream.
As reported by Anton Blanchard when we use percpu_counter_read_positive() to make our orphan socket limit checks, the check can be off by up to num_cpus_online() * batch (which is 32 by default) which on a 128 cpu machine can be as large as the default orphan limit itself.
Fix this by doing the full expensive sum check if the optimized check triggers.
--- include/net/tcp.h | 18 ++++++++++++++---- net/ipv4/tcp.c | 5 +---- net/ipv4/tcp_timer.c | 8 ++++---- 3 files changed, 19 insertions(+), 12 deletions(-)
include/net/tcp.h +14 -4
@@ -268,11 +268,21 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3)return seq3 - seq2 >= seq1 - seq2; } -static inline int tcp_too_many_orphans (struct sock *sk,int num) +static inline bool tcp_too_many_orphans (struct sock *sk,int shift) { -return (num > sysctl_tcp_max_orphans) || - (sk->sk_wmem_queued >SOCK_MIN_SNDBUF && -atomic_read (&tcp_memory_allocated) > sysctl_tcp_mem[2 ]); +struct percpu_counter *ocp = sk->sk_prot->orphan_count; +int orphans =percpu_counter_read_positive (ocp); + +if (orphans << shift > sysctl_tcp_max_orphans) { + orphans =percpu_counter_sum_positive (ocp); +if (orphans << shift > sysctl_tcp_max_orphans) +return true; + } + +if (sk->sk_wmem_queued >SOCK_MIN_SNDBUF && +atomic_read (&tcp_memory_allocated) > sysctl_tcp_mem[2 ]) +return true; +return false; }/* syncookies: remember time of last synqueue overflow */
net/ipv4/tcp.c +1 -4
@@ -2002,11 +2002,8 @@ adjudge_to_death: } }if (sk->sk_state !=TCP_CLOSE ) { -int orphan_count =percpu_counter_read_positive ( - sk->sk_prot->orphan_count); -sk_mem_reclaim (sk); -if (tcp_too_many_orphans (sk, orphan_count)) { +if (tcp_too_many_orphans (sk,0 )) {if (net_ratelimit ())printk (KERN_INFO "TCP: too many of orphaned " "sockets\n" );
net/ipv4/tcp_timer.c +4 -4
@@ -67,18 +67,18 @@ static void tcp_write_err(struct sock *sk)static int tcp_out_of_resources (struct sock *sk,int do_reset) {struct tcp_sock *tp =tcp_sk (sk); -int orphans =percpu_counter_read_positive (&tcp_orphan_count); +int shift =0 ;/* If peer does not open window for long time, or did not transmit * anything for long time, penalize it. */ if ((s32)(tcp_time_stamp - tp->lsndtime) >2 *TCP_RTO_MAX || !do_reset) - orphans <<=1 ; + shift++;/* If some dubious ICMP arrived, penalize even more. */ if (sk->sk_err_soft) - orphans <<=1 ; + shift++; -if (tcp_too_many_orphans (sk, orphans)) { +if (tcp_too_many_orphans (sk, shift)) {if (net_ratelimit ())printk (KERN_INFO "Out of socket memory\n" );
Signature · 1 line
1.7.3.3
PATCH 115/260 tcp: fix three tcp sysctls tuning
In reply to Paul GortmakerFrom: Eric Dumazet <[email protected]>
commit c5ed63d66f24fd4f7089b5a6e087b0ce7202aa8e upstream.
As discovered by Anton Blanchard, current code to autotune tcp_death_row.sysctl_max_tw_buckets, sysctl_tcp_max_orphans and sysctl_max_syn_backlog makes little sense.
The bigger a page is, the less tcp_max_orphans is : 4096 on a 512GB machine in Anton's case.
(tcp_hashinfo.bhash_size * sizeof(struct inet_bind_hashbucket)) is much bigger if spinlock debugging is on. Its wrong to select bigger limits in this case (where kernel structures are also bigger)
bhash_size max is 65536, and we get this value even for small machines.
A better ground is to use size of ehash table, this also makes code shorter and more obvious.
Based on a patch from Anton, and another from David.
--- net/ipv4/tcp.c | 24 +++++++----------------- 1 files changed, 7 insertions(+), 17 deletions(-)
net/ipv4/tcp.c +7 -17
@@ -3192,7 +3192,7 @@ void __init tcp_init(void) {struct sk_buff *skb =NULL ;unsigned long nr_pages, limit; -int order, i, max_share; +int i, max_share, cnt;unsigned long jiffy = jiffies;BUILD_BUG_ON (sizeof (struct tcp_skb_cb ) >sizeof (skb->cb));
@@ -3241,22 +3241,12 @@ void __init tcp_init(void)INIT_HLIST_HEAD (&tcp_hashinfo.bhash[i].chain); } -/* Try to be a bit smarter and adjust defaults depending -* on available memory. -*/ -for (order =0 ; ((1 << order) <<PAGE_SHIFT ) < - (tcp_hashinfo.bhash_size *sizeof (struct inet_bind_hashbucket )); - order++) - ; -if (order >=4 ) { - tcp_death_row.sysctl_max_tw_buckets =180000 ; - sysctl_tcp_max_orphans =4096 << (order -4 ); - sysctl_max_syn_backlog =1024 ; - }else if (order <3 ) { - tcp_death_row.sysctl_max_tw_buckets >>= (3 - order); - sysctl_tcp_max_orphans >>= (3 - order); - sysctl_max_syn_backlog =128 ; - } + + cnt = tcp_hashinfo.ehash_mask +1 ; + + tcp_death_row.sysctl_max_tw_buckets = cnt /2 ; + sysctl_tcp_max_orphans = cnt /2 ; + sysctl_max_syn_backlog =max (128 , cnt /256 );/* Set the pressure threshold to be a fraction of global memory that * is up to 1/2 at 256 MB, decreasing toward zero with the amount of
Signature · 1 line
1.7.3.3
PATCH 116/260 bridge: Clear IPCB before possible entry into IP stack
In reply to Paul GortmakerFrom: Herbert Xu <[email protected]>
commit 17762060c25590bfddd68cc1131f28ec720f405f upstream.
The bridge protocol lives dangerously by having incestuous relations with the IP stack. In this instance an abomination has been created where a bogus IPCB area from a bridged packet leads to a crash in the IP stack because it's interpreted as IP options.
This patch papers over the problem by clearing the IPCB area in that particular spot. To fix this properly we'd also need to parse any IP options if present but I'm way too lazy for that.
Cheers,
--- net/bridge/br_netfilter.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
net/bridge/br_netfilter.c +3 -0
@@ -601,6 +601,9 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff *skb,pskb_trim_rcsum (skb, len); +/* BUG: Should really parse the IP options here. */ +memset (IPCB (skb),0 ,sizeof (struct inet_skb_parm )); +nf_bridge_put (skb->nf_bridge);if (!nf_bridge_alloc (skb))return NF_DROP ;
Signature · 1 line
1.7.3.3
PATCH 117/260 bridge: Clear INET control block of SKBs passed into ip_fragment().
In reply to Paul GortmakerFrom: David S. Miller <[email protected]>
commit 87f94b4e91dc042620c527f3c30c37e5127ef757 upstream.
In a similar vain to commit 17762060c25590bfddd68cc1131f28ec720f405f ("bridge: Clear IPCB before possible entry into IP stack")
Any time we call into the IP stack we have to make sure the state there is as expected by the ipv4 code.
With help from Eric Dumazet and Herbert Xu.
--- net/bridge/br_netfilter.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
net/bridge/br_netfilter.c +4 -2
@@ -801,9 +801,11 @@ static int br_nf_dev_queue_xmit(struct sk_buff *skb)if (skb->nfct !=NULL && (skb->protocol ==htons (ETH_P_IP ) ||IS_VLAN_IP (skb)) && skb->len > skb->dev->mtu && - !skb_is_gso (skb)) + !skb_is_gso (skb)) { +/* BUG: Should really parse the IP options here. */ +memset (IPCB (skb),0 ,sizeof (struct inet_skb_parm ));return ip_fragment (skb, br_dev_queue_push_xmit); -else + }else return br_dev_queue_push_xmit(skb); }#else
Signature · 1 line
1.7.3.3
PATCH 118/260 rds: fix a leak of kernel memory
In reply to Paul GortmakerFrom: Eric Dumazet <[email protected]>
commit f037590fff3005ce8a1513858d7d44f50053cc8f upstream.
struct rds_rdma_notify contains a 32 bits hole on 64bit arches, make sure it is zeroed before copying it to user.
--- net/rds/recv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/rds/recv.c +1 -1
@@ -297,7 +297,7 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc,int rds_notify_queue_get (struct rds_sock *rs,struct msghdr *msghdr) {struct rds_notifier *notifier; -struct rds_rdma_notify cmsg; +struct rds_rdma_notify cmsg = {0 };/* fill holes with zero */ unsigned int count =0 , max_messages = ~0U ;unsigned long flags;LIST_HEAD (copy);
Signature · 1 line
1.7.3.3
PATCH 119/260 tcp: Prevent overzealous packetization by SWS logic.
In reply to Paul GortmakerFrom: Alexey Kuznetsov <[email protected]>
commit 01f83d69844d307be2aa6fea88b0e8fe5cbdb2f4 upstream.
If peer uses tiny MSS (say, 75 bytes) and similarly tiny advertised window, the SWS logic will packetize to half the MSS unnecessarily.
This causes problems with some embedded devices.
However for large MSS devices we do want to half-MSS packetize otherwise we never get enough packets into the pipe for things like fast retransmit and recovery to work.
Be careful also to handle the case where MSS > window, otherwise we'll never send until the probe timer.
--- include/net/tcp.h | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
include/net/tcp.h +16 -2
@@ -518,8 +518,22 @@ extern unsigned int tcp_current_mss(struct sock *sk);/* Bound MSS / TSO packet size with the half of the window */ static inline int tcp_bound_to_half_wnd (struct tcp_sock *tp,int pktsize) { -if (tp->max_window && pktsize > (tp->max_window >>1 )) -return max (tp->max_window >>1 ,68U - tp->tcp_header_len); +int cutoff; + +/* When peer uses tiny windows, there is no use in packetizing +* to sub-MSS pieces for the sake of SWS or making sure there +* are enough packets in the pipe for fast recovery. +* +* On the other hand, for extremely large MSS devices, handling +* smaller than MSS windows in this way does make sense. +*/ +if (tp->max_window >=512 ) + cutoff = (tp->max_window >>1 ); +else + cutoff = tp->max_window; + +if (cutoff && pktsize > cutoff) +return max_t (int, cutoff,68U - tp->tcp_header_len);else return pktsize; }
Signature · 1 line
1.7.3.3
PATCH 120/260 UNIX: Do not loop forever at unix_autobind().
In reply to Paul GortmakerFrom: Tetsuo Handa <[email protected]>
commit 8df73ff90f00f14d2c7ff7156f7ef153f7e9d3b7 upstream.
We assumed that unix_autobind() never fails if kzalloc() succeeded. But unix_autobind() allows only 1048576 names. If /proc/sys/fs/file-max is larger than 1048576 (e.g. systems with more than 10GB of RAM), a local user can consume all names using fork()/socket()/bind().
If all names are in use, those who call bind() with addr_len == sizeof(short) or connect()/sendmsg() with setsockopt(SO_PASSCRED) will continue
while (1)
yield();loop at unix_autobind() till a name becomes available.
This patch adds a loop counter in order to give up after 1048576 attempts.
Calling yield() for once per 256 attempts may not be sufficient when many names are already in use, for __unix_find_socket_byname() can take long time under such circumstance. Therefore, this patch also adds cond_resched() call.
Note that currently a local user can consume 2GB of kernel memory if the user is allowed to create and autobind 1048576 UNIX domain sockets. We should consider adding some restriction for autobind operation.
--- net/unix/af_unix.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)
net/unix/af_unix.c +12 -3
@@ -672,6 +672,7 @@ static int unix_autobind(struct socket *sock)static u32 ordernum =1 ;struct unix_address *addr;int err; +unsigned int retries =0 ;mutex_lock (&u->readlock);
@@ -697,9 +698,17 @@ retry:if (__unix_find_socket_byname (net, addr->name, addr->len, sock->type, addr->hash)) {spin_unlock (&unix_table_lock); -/* Sanity yield. It is unusual case, but yet... */ -if (!(ordernum&0xFF )) -yield (); +/* +* __unix_find_socket_byname() may take long time if many names +* are already in use. +*/ +cond_resched (); +/* Give up if all names seems to be in use. */ +if (retries++ ==0xFFFFF ) { + err = -ENOSPC ; +kfree (addr); + goto out; + } goto retry; } addr->hash ^= sk->sk_type;
Signature · 1 line
1.7.3.3
PATCH 121/260 sparc64: Get rid of indirect p1275 PROM call buffer.
In reply to Paul GortmakerFrom: David S. Miller <[email protected]>
commit 25edd6946a1d74e5e77813c2324a0908c68bcf9e upstream.
This is based upon a report by Meelis Roos showing that it's possible that we'll try to fetch a property that is 32K in size with some devices. With the current fixed 3K buffer we use for moving data in and out of the firmware during PROM calls, that simply won't work.
In fact, it will scramble random kernel data during bootup.
The reasoning behind the temporary buffer is entirely historical. It used to be the case that we had problems referencing dynamic kernel memory (including the stack) early in the boot process before we explicitly told the firwmare to switch us over to the kernel trap table.
So what we did was always give the firmware buffers that were locked into the main kernel image.
But we no longer have problems like that, so get rid of all of this indirect bounce buffering.
Besides fixing Meelis's bug, this also makes the kernel data about 3K smaller.
It was also discovered during these conversions that the implementation of prom_retain() was completely wrong, so that was fixed here as well. Currently that interface is not in use.
--- arch/sparc/include/asm/oplib_64.h | 27 +--- arch/sparc/prom/cif.S | 16 +- arch/sparc/prom/console_64.c | 48 +++++-- arch/sparc/prom/devops_64.c | 36 ++++- arch/sparc/prom/misc_64.c | 314 ++++++++++++++++++++++++++----------- arch/sparc/prom/p1275.c | 102 +------------ arch/sparc/prom/tree_64.c | 210 ++++++++++++++++++------- 7 files changed, 456 insertions(+), 297 deletions(-)
arch/sparc/include/asm/oplib_64.h +3 -24
@@ -185,9 +185,8 @@ extern int prom_getunumber(int syndrome_code, char *buf, int buflen);/* Retain physical memory to the caller across soft resets. */ -extern unsigned long prom_retain (const char *name, -unsigned long pa_low,unsigned long pa_high, -long size,long align); +extern int prom_retain (const char *name,unsigned long size, +unsigned long align,unsigned long *paddr);/* Load explicit I/D TLB entries into the calling processor. */ extern long prom_itlb_load(unsigned long index,
@@ -287,26 +286,6 @@ extern void prom_sun4v_guest_soft_state(void);extern int prom_ihandle2path (int handle,char *buffer,int bufsize);/* Client interface level routines. */ -extern long p1275_cmd (const char *,long , ...); - -#if 0 -#define P1275_SIZE (x) ((((long)((x) / 32)) << 32) | (x)) -#else -#define P1275_SIZE (x) x -#endif - -/* We support at most 16 input and 1 output argument */ -#define P1275_ARG_NUMBER 0 -#define P1275_ARG_IN_STRING 1 -#define P1275_ARG_OUT_BUF 2 -#define P1275_ARG_OUT_32B 3 -#define P1275_ARG_IN_FUNCTION 4 -#define P1275_ARG_IN_BUF 5 -#define P1275_ARG_IN_64B 6 - -#define P1275_IN (x) ((x) & 0xf) -#define P1275_OUT (x) (((x) << 4) & 0xf0) -#define P1275_INOUT (i,o) (P1275_IN(i)|P1275_OUT(o)) -#define P1275_ARG (n,x) ((x) << ((n)*3 + 8)) +extern void p1275_cmd_direct (unsigned long *);#endif /* !(__SPARC64_OPLIB_H) */
arch/sparc/prom/cif.S +8 -8
@@ -9,18 +9,18 @@ #include <asm/thread_info.h> .text - .globl prom_cif_interface -prom_cif_interface: - sethi %hi(p1275buf), %o0 - or %o0, %lo(p1275buf), %o0 - ldx [%o0 + 0x010], %o1 ! prom_cif_stack - save %o1, -192, %sp - ldx [%i0 + 0x008], %l2 ! prom_cif_handler + .globl prom_cif_direct +prom_cif_direct: + sethi %hi(p1275buf), %o1 + or %o1, %lo(p1275buf), %o1 + ldx [%o1 + 0x0010], %o2 ! prom_cif_stack + save %o2, -192, %sp + ldx [%i1 + 0x0008], %l2 ! prom_cif_handler mov %g4, %l0 mov %g5, %l1 mov %g6, %l3 call %l2 - add %i0, 0x018, %o0 ! prom_args + mov %i0, %o0 ! prom_args mov %l0, %g4 mov %l1, %g5 mov %l3, %g6
arch/sparc/prom/console_64.c +37 -11
70 lines not on this page · raw message
arch/sparc/prom/devops_64.c +31 -5
@@ -18,16 +18,32 @@int prom_devopen (const char *dstr) { -return p1275_cmd ("open" ,P1275_ARG (0 ,P1275_ARG_IN_STRING )| -P1275_INOUT (1 ,1 ), - dstr); +unsigned long args[5 ]; + + args[0 ] = (unsigned long )"open" ; + args[1 ] =1 ; + args[2 ] =1 ; + args[3 ] = (unsigned long ) dstr; + args[4 ] = (unsigned long )-1 ; + +p1275_cmd_direct (args); + +return (int ) args[4 ]; }/* Close the device described by device handle 'dhandle'. */ int prom_devclose (int dhandle) { -p1275_cmd ("close" ,P1275_INOUT (1 ,0 ), dhandle); +unsigned long args[4 ]; + + args[0 ] = (unsigned long )"close" ; + args[1 ] =1 ; + args[2 ] =0 ; + args[3 ] = (unsigned int ) dhandle; + +p1275_cmd_direct (args); +return 0 ; }
@@ -37,5 +53,15 @@ prom_devclose(int dhandle)void prom_seek (int dhandle,unsigned int seekhi,unsigned int seeklo) { -p1275_cmd ("seek" ,P1275_INOUT (3 ,1 ), dhandle, seekhi, seeklo); +unsigned long args[7 ]; + + args[0 ] = (unsigned long )"seek" ; + args[1 ] =3 ; + args[2 ] =1 ; + args[3 ] = (unsigned int ) dhandle; + args[4 ] = seekhi; + args[5 ] = seeklo; + args[6 ] = (unsigned long )-1 ; + +p1275_cmd_direct (args); }
arch/sparc/prom/misc_64.c +220 -94
464 lines not on this page · raw message
arch/sparc/prom/p1275.c +3 -99
130 lines not on this page · raw message
arch/sparc/prom/tree_64.c +154 -56
354 lines not on this page · raw message
Signature · 1 line
1.7.3.3
PATCH 122/260 drivers/net/usb/hso.c: prevent reading uninitialized memory
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
commit 7011e660938fc44ed86319c18a5954e95a82ab3e upstream.
Fixed formatting (tabs and line breaks).
The TIOCGICOUNT device ioctl allows unprivileged users to read uninitialized stack memory, because the "reserved" member of the serial_icounter_struct struct declared on the stack in hso_get_count() is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/net/usb/hso.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/usb/hso.c +2 -0
@@ -1654,6 +1654,8 @@ static int hso_get_count(struct hso_serial *serial,struct uart_icount cnow;struct hso_tiocmget *tiocmget = serial->tiocmget; +memset (&icount,0 ,sizeof (struct serial_icounter_struct )); +if (!tiocmget)return -ENOENT ;spin_lock_irq (&serial->serial_lock);
Signature · 1 line
1.7.3.3
PATCH 123/260 drivers/net/cxgb3/cxgb3_main.c: prevent reading uninitialized stack memory
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
commit 49c37c0334a9b85d30ab3d6b5d1acb05ef2ef6de upstream.
Fixed formatting (tabs and line breaks).
The CHELSIO_GET_QSET_NUM device ioctl allows unprivileged users to read 4 bytes of uninitialized stack memory, because the "addr" member of the ch_reg struct declared on the stack in cxgb_extension_ioctl() is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/net/cxgb3/cxgb3_main.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/cxgb3/cxgb3_main.c +2 -0
@@ -2296,6 +2296,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)case CHELSIO_GET_QSET_NUM :{struct ch_reg edata; +memset (&edata,0 ,sizeof (struct ch_reg )); + edata.cmd =CHELSIO_GET_QSET_NUM ; edata.val = pi->nqsets;if (copy_to_user (useraddr, &edata,sizeof (edata)))
Signature · 1 line
1.7.3.3
PATCH 124/260 drivers/net/eql.c: prevent reading uninitialized stack memory
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
commit 44467187dc22fdd33a1a06ea0ba86ce20be3fe3c upstream.
Fixed formatting (tabs and line breaks).
The EQL_GETMASTRCFG device ioctl allows unprivileged users to read 16 bytes of uninitialized stack memory, because the "master_name" member of the master_config_t struct declared on the stack in eql_g_master_cfg() is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/net/eql.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/eql.c +2 -0
@@ -555,6 +555,8 @@ static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mcp)equalizer_t *eql;master_config_t mc; +memset (&mc,0 ,sizeof (master_config_t)); +if (eql_is_master (dev)) { eql =netdev_priv (dev); mc.max_slaves = eql->max_slaves;
Signature · 1 line
1.7.3.3
PATCH 125/260 bonding: correctly process non-linear skbs
In reply to Paul GortmakerFrom: Andy Gospodarek <[email protected]>
commit ab12811c89e88f2e66746790b1fe4469ccb7bdd9 upstream.
It was recently brought to my attention that 802.3ad mode bonds would no longer form when using some network hardware after a driver update. After snooping around I realized that the particular hardware was using page-based skbs and found that skb->data did not contain a valid LACPDU as it was not stored there. That explained the inability to form an 802.3ad-based bond. For balance-alb mode bonds this was also an issue as ARPs would not be properly processed.
This patch fixes the issue in my tests and should be applied to 2.6.36 and as far back as anyone cares to add it to stable.
Thanks to Alexander Duyck <[email protected]> and Jesse Brandeburg <[email protected]> for the suggestions on this one.
--- drivers/net/bonding/bond_3ad.c | 3 +++ drivers/net/bonding/bond_alb.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/bonding/bond_3ad.c +3 -0
@@ -2466,6 +2466,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pacif (!(dev->flags &IFF_MASTER )) goto out; +if (!pskb_may_pull (skb,sizeof (struct lacpdu ))) + goto out; +read_lock (&bond->lock); slave =bond_get_slave_by_dev ((struct bonding *)netdev_priv (dev), orig_dev);
drivers/net/bonding/bond_alb.c +3 -0
@@ -368,6 +368,9 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct goto out; } +if (!pskb_may_pull (skb,arp_hdr_len (bond_dev))) + goto out; +if (skb->len <sizeof (struct arp_pkt )) {pr_debug ("Packet is too small to be an ARP\n" ); goto out;
Signature · 1 line
1.7.3.3
PATCH 126/260 Staging: vt6655: fix buffer overflow
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
commit dd173abfead903c7df54e977535973f3312cd307 upstream.
"param->u.wpa_associate.wpa_ie_len" comes from the user. We should check it so that the copy_from_user() doesn't overflow the buffer.
Also further down in the function, we assume that if "param->u.wpa_associate.wpa_ie_len" is set then "abyWPAIE[0]" is initialized. To make that work, I changed the test here to say that if "wpa_ie_len" is set then "wpa_ie" has to be a valid pointer or we return -EINVAL.
Oddly, we only use the first element of the abyWPAIE[] array. So I suspect there may be some other issues in this function.
--- drivers/staging/vt6655/wpactl.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
drivers/staging/vt6655/wpactl.c +8 -3
@@ -767,9 +767,14 @@ static int wpa_set_associate(PSDevice pDevice,DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "wpa_ie_len = %d\n" , param->u.wpa_associate.wpa_ie_len); -if (param->u.wpa_associate.wpa_ie && -copy_from_user (&abyWPAIE[0 ], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) -return -EINVAL ; +if (param->u.wpa_associate.wpa_ie_len) { +if (!param->u.wpa_associate.wpa_ie) +return -EINVAL ; +if (param->u.wpa_associate.wpa_ie_len >sizeof (abyWPAIE)) +return -EINVAL ; +if (copy_from_user (&abyWPAIE[0 ], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) +return -EFAULT ; + }if (param->u.wpa_associate.mode ==1 ) pMgmt->eConfigMode =WMAC_CONFIG_IBSS_STA ;
Signature · 1 line
1.7.3.3
PATCH 127/260 net/llc: make opt unsigned in llc_ui_setsockopt()
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
commit 339db11b219f36cf7da61b390992d95bb6b7ba2e upstream.
The members of struct llc_sock are unsigned so if we pass a negative value for "opt" it can cause a sign bug. Also it can cause an integer overflow when we multiply "opt * HZ".
--- net/llc/af_llc.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/llc/af_llc.c +2 -1
@@ -1024,7 +1024,8 @@ static int llc_ui_setsockopt(struct socket *sock, int level, int optname, {struct sock *sk = sock->sk;struct llc_sock *llc =llc_sk (sk); -int rc = -EINVAL , opt; +unsigned int opt; +int rc = -EINVAL ;lock_sock (sk);if (unlikely (level !=SOL_LLC || optlen !=sizeof (int )))
Signature · 1 line
1.7.3.3
PATCH 128/260 pid: make setpgid() system call use RCU read-side critical section
In reply to Paul GortmakerFrom: Paul E. McKenney <[email protected]>
commit 950eaaca681c44aab87a46225c9e44f902c080aa upstream.
[ 23.584719]
[ 23.584720] ===================================================
[ 23.585059] [ INFO: suspicious rcu_dereference_check() usage. ]
[ 23.585176] ---------------------------------------------------
[ 23.585176] kernel/pid.c:419 invoked rcu_dereference_check() without protection!
[ 23.585176]
[ 23.585176] other info that might help us debug this:
[ 23.585176]
[ 23.585176]
[ 23.585176] rcu_scheduler_active = 1, debug_locks = 1
[ 23.585176] 1 lock held by rc.sysinit/728:
[ 23.585176] #0: (tasklist_lock){.+.+..}, at: [<ffffffff8104771f>] sys_setpgid+0x5f/0x193
[ 23.585176]
[ 23.585176] stack backtrace:
[ 23.585176] Pid: 728, comm: rc.sysinit Not tainted 2.6.36-rc2 #2
[ 23.585176] Call Trace:
[ 23.585176] [<ffffffff8105b436>] lockdep_rcu_dereference+0x99/0xa2
[ 23.585176] [<ffffffff8104c324>] find_task_by_pid_ns+0x50/0x6a
[ 23.585176] [<ffffffff8104c35b>] find_task_by_vpid+0x1d/0x1f
[ 23.585176] [<ffffffff81047727>] sys_setpgid+0x67/0x193
[ 23.585176] [<ffffffff810029eb>] system_call_fastpath+0x16/0x1b
[ 24.959669] type=1400 audit(1282938522.956:4): avc: denied { module_request } for pid=766 comm="hwclock" kmod="char-major-10-135" scontext=system_u:system_r:hwclock_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclasIt turns out that the setpgid() system call fails to enter an RCU read-side critical section before doing a PID-to-task_struct translation. This commit therefore does rcu_read_lock() before the translation, and also does rcu_read_unlock() after the last use of the returned pointer.
--- kernel/sys.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/sys.c +2 -0
@@ -962,6 +962,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) pgid = pid;if (pgid <0 )return -EINVAL ; +rcu_read_lock ();/* From this point forward we keep holding onto the tasklist lock * so that our parent does not change from under us. -DaveM
@@ -1015,6 +1016,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) out:/* All paths lead to here, thus we are safe. -DaveM */ write_unlock_irq (&tasklist_lock); +rcu_read_unlock ();return err; }
Signature · 1 line
1.7.3.3
PATCH 129/260 sched: Fix user time incorrectly accounted as system time on 32-bit
In reply to Paul GortmakerFrom: Stanislaw Gruszka <[email protected]>
commit e75e863dd5c7d96b91ebbd241da5328fc38a78cc upstream.
We have 32-bit variable overflow possibility when multiply in task_times() and thread_group_times() functions. When the overflow happens then the scaled utime value becomes erroneously small and the scaled stime becomes i erroneously big.
Reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=633037
https://bugzilla.kernel.org/show_bug.cgi?id=16559
LKML-Reference: <[email protected]>
--- kernel/sched.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
kernel/sched.c +4 -4
@@ -3428,9 +3428,9 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st) rtime =nsecs_to_cputime (p->se.sum_exec_runtime);if (total) { -u64 temp; +u64 temp = rtime; - temp = (u64)(rtime * utime); + temp *= utime;do_div (temp, total); utime = (cputime_t )temp; }else
@@ -3461,9 +3461,9 @@ void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st) rtime =nsecs_to_cputime (cputime.sum_exec_runtime);if (total) { -u64 temp; +u64 temp = rtime; - temp = (u64)(rtime * cputime.utime); + temp *= cputime.utime;do_div (temp, total); utime = (cputime_t )temp; }else
Signature · 1 line
1.7.3.3
PATCH 130/260 oprofile: Add Support for Intel CPU Family 6 / Model 22 (Intel Celeron 540)
In reply to Paul GortmakerFrom: Patrick Simmons <[email protected]>
commit c33f543d320843e1732534c3931da4bbd18e6c14 upstream.
This patch adds CPU type detection for the Intel Celeron 540, which is part of the Core 2 family according to Wikipedia; the family and ID pair is absent from the Volume 3B table referenced in the source code comments. I have tested this patch on an Intel Celeron 540 machine reporting itself as Family 6 Model 22, and OProfile runs on the machine without issue.
Spec:
http://download.intel.com/design/mobile/SPECUPDT/317667.pdf
--- arch/x86/oprofile/nmi_int.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/x86/oprofile/nmi_int.c +3 -1
@@ -621,7 +621,9 @@ static int __init ppro_init(char **cpu_type)case 14 : *cpu_type ="i386/core" ;break ; -case 15 :case 23 : +case 0x0f : +case 0x16 : +case 0x17 : *cpu_type ="i386/core_2" ;break ;case 0x1a :
Signature · 1 line
1.7.3.3
PATCH 131/260 char: Mark /dev/zero and /dev/kmem as not capable of writeback
In reply to Paul GortmakerFrom: Jan Kara <[email protected]>
commit 371d217ee1ff8b418b8f73fb2a34990f951ec2d4 upstream.
These devices don't do any writeback but their device inodes still can get dirty so mark bdi appropriately so that bdi code does the right thing and files inodes to lists of bdi carrying the device inodes.
--- drivers/char/mem.c | 3 ++- fs/char_dev.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/char/mem.c +2 -1
@@ -788,10 +788,11 @@ static const struct file_operations zero_fops = {/* * capabilities for /dev/zero * - permits private mappings, "copies" are taken of the source of zeros +* - no writeback happens */ static struct backing_dev_info zero_bdi = { .name ="char/mem" , - .capabilities =BDI_CAP_MAP_COPY , + .capabilities =BDI_CAP_MAP_COPY |BDI_CAP_NO_ACCT_AND_WRITEBACK , };static const struct file_operations full_fops = {
fs/char_dev.c +3 -1
@@ -39,7 +39,9 @@ struct backing_dev_info directly_mappable_cdev_bdi = {#endif /* permit direct mmap, for read, write or exec */ BDI_CAP_MAP_DIRECT | - BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP), +BDI_CAP_READ_MAP |BDI_CAP_WRITE_MAP |BDI_CAP_EXEC_MAP | +/* no writeback happens */ + BDI_CAP_NO_ACCT_AND_WRITEBACK), };static struct kobj_map *cdev_map;
Signature · 1 line
1.7.3.3
PATCH 132/260 drivers/pci/intel-iommu.c: fix build with older gcc's
In reply to Paul GortmakerFrom: Andrew Morton <[email protected]>
commit df08cdc7ef606509debe7677c439be0ca48790e4 upstream.
drivers/pci/intel-iommu.c: In function `__iommu_calculate_agaw':drivers/pci/intel-iommu.c:437: sorry, unimplemented: inlining failed in call to 'width_to_agaw': function body not available drivers/pci/intel-iommu.c:445: sorry, unimplemented: called from here
Move the offending function (and its siblings) to top-of-file, remove the forward declaration.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=17441
--- drivers/pci/intel-iommu.c | 90 +++++++++++++++++++++----------------------- 1 files changed, 43 insertions(+), 47 deletions(-)
drivers/pci/intel-iommu.c +43 -47
@@ -71,6 +71,49 @@#define DMA_32BIT_PFN IOVA_PFN(DMA_BIT_MASK(32))#define DMA_64BIT_PFN IOVA_PFN(DMA_BIT_MASK(64)) +/* page table handling */ +#define LEVEL_STRIDE (9) +#define LEVEL_MASK (((u64)1 << LEVEL_STRIDE) - 1) + +static inline int agaw_to_level (int agaw) +{ +return agaw +2 ; +} + +static inline int agaw_to_width (int agaw) +{ +return 30 + agaw *LEVEL_STRIDE ; +} + +static inline int width_to_agaw (int width) +{ +return (width -30 ) /LEVEL_STRIDE ; +} + +static inline unsigned int level_to_offset_bits (int level) +{ +return (level -1 ) *LEVEL_STRIDE ; +} + +static inline int pfn_level_offset (unsigned long pfn,int level) +{ +return (pfn >>level_to_offset_bits (level)) &LEVEL_MASK ; +} + +static inline unsigned long level_mask (int level) +{ +return -1UL <<level_to_offset_bits (level); +} + +static inline unsigned long level_size (int level) +{ +return 1UL <<level_to_offset_bits (level); +} + +static inline unsigned long align_to_level (unsigned long pfn,int level) +{ +return (pfn +level_size (level) -1 ) &level_mask (level); +}/* VT-d pages must always be _smaller_ than MM pages. Otherwise things are never going to work. */
@@ -434,8 +477,6 @@ void free_iova_mem(struct iova *iova) } -static inline int width_to_agaw (int width); -static int __iommu_calculate_agaw (struct intel_iommu *iommu,int max_gaw) {unsigned long sagaw;
@@ -650,51 +691,6 @@ out:spin_unlock_irqrestore (&iommu->lock, flags); } -/* page table handling */ -#define LEVEL_STRIDE (9) -#define LEVEL_MASK (((u64)1 << LEVEL_STRIDE) - 1) - -static inline int agaw_to_level (int agaw) -{ -return agaw +2 ; -} - -static inline int agaw_to_width (int agaw) -{ -return 30 + agaw *LEVEL_STRIDE ; - -} - -static inline int width_to_agaw (int width) -{ -return (width -30 ) /LEVEL_STRIDE ; -} - -static inline unsigned int level_to_offset_bits (int level) -{ -return (level -1 ) *LEVEL_STRIDE ; -} - -static inline int pfn_level_offset (unsigned long pfn,int level) -{ -return (pfn >>level_to_offset_bits (level)) &LEVEL_MASK ; -} - -static inline unsigned long level_mask (int level) -{ -return -1UL <<level_to_offset_bits (level); -} - -static inline unsigned long level_size (int level) -{ -return 1UL <<level_to_offset_bits (level); -} - -static inline unsigned long align_to_level (unsigned long pfn,int level) -{ -return (pfn +level_size (level) -1 ) &level_mask (level); -} -static struct dma_pte *pfn_to_dma_pte (struct dmar_domain *domain,unsigned long pfn) {
Signature · 1 line
1.7.3.3
PATCH 133/260 drivers/video/sis/sis_main.c: prevent reading uninitialized stack memory
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
commit fd02db9de73faebc51240619c7c7f99bee9f65c7 upstream.
The FBIOGET_VBLANK device ioctl allows unprivileged users to read 16 bytes of uninitialized stack memory, because the "reserved" member of the fb_vblank struct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/video/sis/sis_main.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/video/sis/sis_main.c +3 -0
@@ -1701,6 +1701,9 @@ static int sisfb_ioctl(struct fb_info *info, unsigned int cmd,break ;case FBIOGET_VBLANK : + +memset (&sisvbblank,0 ,sizeof (struct fb_vblank )); + sisvbblank.count =0 ; sisvbblank.flags =sisfb_setupvbblankflags (ivideo, &sisvbblank.vcount, &sisvbblank.hcount);
Signature · 1 line
1.7.3.3
PATCH 134/260 percpu: fix pcpu_last_unit_cpu
In reply to Paul GortmakerFrom: Tejun Heo <[email protected]>
commit 46b30ea9bc3698bc1d1e6fd726c9601d46fa0a91 upstream.
pcpu_first/last_unit_cpu are used to track which cpu has the first and last units assigned. This in turn is used to determine the span of a chunk for man/unmap cache flushes and whether an address belongs to the first chunk or not in per_cpu_ptr_to_phys().
When the number of possible CPUs isn't power of two, a chunk may contain unassigned units towards the end of a chunk. The logic to determine pcpu_last_unit_cpu was incorrect when there was an unused unit at the end of a chunk. It failed to ignore the unused unit and assigned the unused marker NR_CPUS to pcpu_last_unit_cpu.
This was discovered through kdump failure which was caused by malfunctioning per_cpu_ptr_to_phys() on a kvm setup with 50 possible CPUs by CAI Qian.
--- mm/percpu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
mm/percpu.c +1 -1
@@ -1750,9 +1750,9 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,if (pcpu_first_unit_cpu ==NR_CPUS ) pcpu_first_unit_cpu = cpu; + pcpu_last_unit_cpu = cpu; } } - pcpu_last_unit_cpu = cpu; pcpu_nr_units = unit;for_each_possible_cpu (cpu)
Signature · 1 line
1.7.3.3
PATCH 135/260 aio: check for multiplication overflow in do_io_submit
In reply to Paul GortmakerFrom: Jeff Moyer <[email protected]>
commit 75e1c70fc31490ef8a373ea2a4bea2524099b478 upstream.
Tavis Ormandy pointed out that do_io_submit does not do proper bounds checking on the passed-in iocb array:
if (unlikely(nr < 0))
return -EINVAL;
if (unlikely(!access_ok(VERIFY_READ, iocbpp, (nr*sizeof(iocbpp))))) return -EFAULT; ^^^^^^^^^^^^^^^^^^
The attached patch checks for overflow, and if it is detected, the number of iocbs submitted is scaled down to a number that will fit in the long. This is an ok thing to do, as sys_io_submit is documented as returning the number of iocbs submitted, so callers should handle a return value of less than the 'nr' argument passed in.
--- fs/aio.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
fs/aio.c +3 -0
@@ -1659,6 +1659,9 @@ long do_io_submit(aio_context_t ctx_id, long nr,if (unlikely (nr <0 ))return -EINVAL ; +if (unlikely (nr >LONG_MAX /sizeof (*iocbpp))) + nr =LONG_MAX /sizeof (*iocbpp); +if (unlikely (!access_ok (VERIFY_READ , iocbpp, (nr*sizeof (*iocbpp)))))return -EFAULT ;
Signature · 1 line
1.7.3.3
PATCH 136/260 inotify: send IN_UNMOUNT events
In reply to Paul GortmakerFrom: Eric Paris <[email protected]>
commit 611da04f7a31b2208e838be55a42c7a1310ae321 upstream.
Since the .31 or so notify rewrite inotify has not sent events about inodes which are unmounted. This patch restores those events.
--- fs/notify/inotify/inotify_user.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
fs/notify/inotify/inotify_user.c +5 -2
@@ -96,8 +96,11 @@ static inline __u32 inotify_arg_to_mask(u32 arg) {__u32 mask; -/* everything should accept their own ignored and cares about children */ - mask = (FS_IN_IGNORED |FS_EVENT_ON_CHILD ); +/* +* everything should accept their own ignored, cares about children, +* and should receive events when the inode is unmounted +*/ + mask = (FS_IN_IGNORED |FS_EVENT_ON_CHILD |FS_UNMOUNT );/* mask off the flags used to open the fd */ mask |= (arg & (IN_ALL_EVENTS |IN_ONESHOT ));
Signature · 1 line
1.7.3.3
PATCH 137/260 mptsas: fix hangs caused by ATA pass-through
In reply to Paul GortmakerFrom: Ryan Kuester <[email protected]>
commit 2a1b7e575b80ceb19ea50bfa86ce0053ea57181d upstream.
I may have an explanation for the LSI 1068 HBA hangs provoked by ATA pass-through commands, in particular by smartctl.
First, my version of the symptoms. On an LSI SAS1068E B3 HBA running 01.29.00.00 firmware, with SATA disks, and with smartd running, I'm seeing occasional task, bus, and host resets, some of which lead to hard faults of the HBA requiring a reboot. Abusively looping the smartctl command,
# while true; do smartctl -a /dev/sdb > /dev/null; done
dramatically increases the frequency of these failures to nearly one per minute. A high IO load through the HBA while looping smartctl seems to improve the chance of a full scsi host reset or a non-recoverable hang.
I reduced what smartctl was doing down to a simple test case which causes the hang with a single IO when pointed at the sd interface. See the code at the bottom of this e-mail. It uses an SG_IO ioctl to issue a single pass-through ATA identify device command. If the buffer userspace gives for the read data has certain alignments, the task is issued to the HBA but the HBA fails to respond. If run against the sg interface, neither the test code nor smartctl causes a hang.
sd and sg handle the SG_IO ioctl slightly differently. Unless you specifically set a flag to do direct IO, sg passes a buffer of its own, which is page-aligned, to the block layer and later copies the result into the userspace buffer regardless of its alignment. sd, on the other hand, always does direct IO unless the userspace buffer fails an alignment test at block/blk-map.c line 57, in which case a page-aligned buffer is created and used for the transfer.
The alignment test currently checks for word-alignment, the default setup by scsi_lib.c; therefore, userspace buffers of almost any alignment are given directly to the HBA as DMA targets. The LSI 1068 hardware doesn't seem to like at least a couple of the alignments which cross a page boundary (see the test code below). Curiously, many page-boundary-crossing alignments do work just fine.
So, either the hardware has an bug handling certain alignments or the hardware has a stricter alignment requirement than the driver is advertising. If stricter alignment is required, then in no case should misaligned buffers from userspace be allowed through without being bounced or at least causing an error to be returned.
It seems the mptsas driver could use blk_queue_dma_alignment() to advertise a stricter alignment requirement. If it does, sd does the right thing and bounces misaligned buffers (see block/blk-map.c line 57). The following patch to 2.6.34-rc5 makes my symptoms go away. I'm sure this is the wrong place for this code, but it gets my idea across.
--- drivers/message/fusion/mptscsih.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/message/fusion/mptscsih.c +2 -0
@@ -2450,6 +2450,8 @@ mptscsih_slave_configure(struct scsi_device *sdev) ioc->name,sdev->tagged_supported, sdev->simple_tags, sdev->ordered_tags)); +blk_queue_dma_alignment (sdev->request_queue,512 -1 ); +return 0 ; }
Signature · 1 line
1.7.3.3
PATCH 138/260 ext4: Fix remaining racy updates of EXT4_I(inode)->i_flags
In reply to Paul GortmakerFrom: Dmitry Monakhov <[email protected]>
commit 84a8dce2710cc425089a2b92acc354d4fbb5788d upstream.
A few functions were still modifying i_flags in a racy manner.
--- fs/ext4/inode.c | 40 +++++++++++++++++++++++----------------- 1 files changed, 23 insertions(+), 17 deletions(-)
fs/ext4/inode.c +23 -17
@@ -4932,20 +4932,26 @@ void ext4_set_inode_flags(struct inode *inode)/* Propagate flags from i_flags to EXT4_I(inode)->i_flags */ void ext4_get_inode_flags (struct ext4_inode_info *ei) { -unsigned int flags = ei->vfs_inode.i_flags; - - ei->i_flags &= ~(EXT4_SYNC_FL |EXT4_APPEND_FL | -EXT4_IMMUTABLE_FL |EXT4_NOATIME_FL |EXT4_DIRSYNC_FL ); -if (flags &S_SYNC ) - ei->i_flags |=EXT4_SYNC_FL ; -if (flags &S_APPEND ) - ei->i_flags |=EXT4_APPEND_FL ; -if (flags &S_IMMUTABLE ) - ei->i_flags |=EXT4_IMMUTABLE_FL ; -if (flags &S_NOATIME ) - ei->i_flags |=EXT4_NOATIME_FL ; -if (flags &S_DIRSYNC ) - ei->i_flags |=EXT4_DIRSYNC_FL ; +unsigned int vfs_fl; +unsigned long old_fl, new_fl; + +do { + vfs_fl = ei->vfs_inode.i_flags; + old_fl = ei->i_flags; + new_fl = old_fl & ~(EXT4_SYNC_FL |EXT4_APPEND_FL | +EXT4_IMMUTABLE_FL |EXT4_NOATIME_FL | +EXT4_DIRSYNC_FL ); +if (vfs_fl &S_SYNC ) + new_fl |=EXT4_SYNC_FL ; +if (vfs_fl &S_APPEND ) + new_fl |=EXT4_APPEND_FL ; +if (vfs_fl &S_IMMUTABLE ) + new_fl |=EXT4_IMMUTABLE_FL ; +if (vfs_fl &S_NOATIME ) + new_fl |=EXT4_NOATIME_FL ; +if (vfs_fl &S_DIRSYNC ) + new_fl |=EXT4_DIRSYNC_FL ; + }while (cmpxchg (&ei->i_flags, old_fl, new_fl) != old_fl); } static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,
@@ -5182,7 +5188,7 @@ static int ext4_inode_blocks_set(handle_t *handle,*/ raw_inode->i_blocks_lo =cpu_to_le32 (i_blocks); raw_inode->i_blocks_high =0 ; - ei->i_flags &= ~EXT4_HUGE_FILE_FL ; +ext4_clear_inode_flag (inode,EXT4_INODE_HUGE_FILE );return 0 ; }if (!EXT4_HAS_RO_COMPAT_FEATURE (sb,EXT4_FEATURE_RO_COMPAT_HUGE_FILE ))
@@ -5195,9 +5201,9 @@ static int ext4_inode_blocks_set(handle_t *handle,*/ raw_inode->i_blocks_lo =cpu_to_le32 (i_blocks); raw_inode->i_blocks_high =cpu_to_le16 (i_blocks >>32 ); - ei->i_flags &= ~EXT4_HUGE_FILE_FL ; +ext4_clear_inode_flag (inode,EXT4_INODE_HUGE_FILE ); }else { - ei->i_flags |=EXT4_HUGE_FILE_FL ; +ext4_set_inode_flag (inode,EXT4_INODE_HUGE_FILE );/* i_block is stored in file system block size */ i_blocks = i_blocks >> (inode->i_blkbits -9 ); raw_inode->i_blocks_lo =cpu_to_le32 (i_blocks);
Signature · 1 line
1.7.3.3
PATCH 139/260 fix siglock
In reply to Paul GortmakerFrom: Tony Luck <[email protected]>
commit f574c843191728d9407b766a027f779dcd27b272 upstream.
When ia64 converted to using ticket locks, an inline implementation of trylock/unlock in fsys.S was missed. This was not noticed because in most circumstances it simply resulted in using the slow path because the siglock was apparently not available (under old spinlock rules).
Problems occur when the ticket spinlock has value 0x0 (when first initialised, or when it wraps around). At this point the fsys.S code acquires the lock (changing the 0x0 to 0x1. If another process attempts to get the lock at this point, it will change the value from 0x1 to 0x2 (using new ticket lock rules). Then the fsys.S code will free the lock using old spinlock rules by writing 0x0 to it. From here a variety of bad things can happen.
--- arch/ia64/kernel/fsys.S | 46 +++++++++++++++++++++++++++++++++++++++------- 1 files changed, 39 insertions(+), 7 deletions(-)
arch/ia64/kernel/fsys.S +39 -7
@@ -424,14 +424,26 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP #ifdef CONFIG_SMP - mov r17=1 - ;; - cmpxchg4.acq r18=[r31],r17,ar.ccv // try to acquire the lock + // __ticket_spin_trylock(r31) + ld4 r17=[r31] mov r8=EINVAL // default to EINVAL ;; + extr r9=r17,17,15 + ;; + xor r18=r17,r9 + adds r19=1,r17 + ;; + extr.u r18=r18,0,15 + ;; + cmp.eq p0,p7=0,r18 +(p7) br.cond.spnt.many .lock_contention + mov.m ar.ccv=r17 + ;; + cmpxchg4.acq r9=[r31],r19,ar.ccv + ;; + cmp4.eq p0,p7=r9,r17 +(p7) br.cond.spnt.many .lock_contention ld8 r3=[r2] // re-read current->blocked now that we hold the lock - cmp4.ne p6,p0=r18,r0 -(p6) br.cond.spnt.many .lock_contention ;; #else ld8 r3=[r2] // re-read current->blocked now that we hold the lock
@@ -490,7 +502,17 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set (p6) br.cond.spnt.few 1b // yes -> retry #ifdef CONFIG_SMP - st4.rel [r31]=r0 // release the lock + // __ticket_spin_unlock(r31) + adds r31=2,r31 + ;; + ld2.bias r2=[r31] + mov r3=65534 + ;; + adds r2=2,r2 + ;; + and r3=r3,r2 + ;; + st2.rel [r31]=r3 #endif SSM_PSR_I(p0, p9, r31) ;;
@@ -512,7 +534,17 @@ EX(.fail_efault, (p15) st8 [r34]=r3) .sig_pending: #ifdef CONFIG_SMP - st4.rel [r31]=r0 // release the lock + // __ticket_spin_unlock(r31) + adds r31=2,r31 + ;; + ld2.bias r2=[r31] + mov r3=65534 + ;; + adds r2=2,r2 + ;; + and r3=r3,r2 + ;; + st2.rel [r31]=r3 #endif SSM_PSR_I(p0, p9, r17) ;;
Signature · 1 line
1.7.3.3
PATCH 140/260 Optimize ticket spinlocks in fsys_rt_sigprocmask
In reply to Paul GortmakerFrom: Petr Tesarik <[email protected]>
commit 2d2b6901649a62977452be85df53eda2412def24 upstream.
Tony's fix (f574c843191728d9407b766a027f779dcd27b272) has a small bug, it incorrectly uses "r3" as a scratch register in the first of the two unlock paths ... it is also inefficient. Optimize the fast path again.
--- arch/ia64/kernel/fsys.S | 42 +++++++++++------------------------------- 1 files changed, 11 insertions(+), 31 deletions(-)
arch/ia64/kernel/fsys.S +11 -31
@@ -420,34 +420,31 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set ;; RSM_PSR_I(p0, r18, r19) // mask interrupt delivery - mov ar.ccv=0 andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP + mov r8=EINVAL // default to EINVAL #ifdef CONFIG_SMP // __ticket_spin_trylock(r31) ld4 r17=[r31] - mov r8=EINVAL // default to EINVAL - ;; - extr r9=r17,17,15 ;; - xor r18=r17,r9 + mov.m ar.ccv=r17 + extr.u r9=r17,17,15 adds r19=1,r17 + extr.u r18=r17,0,15 ;; - extr.u r18=r18,0,15 + cmp.eq p6,p7=r9,r18 ;; - cmp.eq p0,p7=0,r18 +(p6) cmpxchg4.acq r9=[r31],r19,ar.ccv +(p6) dep.z r20=r19,1,15 // next serving ticket for unlock (p7) br.cond.spnt.many .lock_contention - mov.m ar.ccv=r17 - ;; - cmpxchg4.acq r9=[r31],r19,ar.ccv ;; cmp4.eq p0,p7=r9,r17 + adds r31=2,r31 (p7) br.cond.spnt.many .lock_contention ld8 r3=[r2] // re-read current->blocked now that we hold the lock ;; #else ld8 r3=[r2] // re-read current->blocked now that we hold the lock - mov r8=EINVAL // default to EINVAL #endif add r18=IA64_TASK_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r16 add r19=IA64_TASK_SIGNAL_OFFSET,r16
@@ -503,16 +500,8 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set #ifdef CONFIG_SMP // __ticket_spin_unlock(r31) - adds r31=2,r31 - ;; - ld2.bias r2=[r31] - mov r3=65534 - ;; - adds r2=2,r2 - ;; - and r3=r3,r2 - ;; - st2.rel [r31]=r3 + st2.rel [r31]=r20 + mov r20=0 // i must not leak kernel bits... #endif SSM_PSR_I(p0, p9, r31) ;;
@@ -535,16 +524,7 @@ EX(.fail_efault, (p15) st8 [r34]=r3) .sig_pending: #ifdef CONFIG_SMP // __ticket_spin_unlock(r31) - adds r31=2,r31 - ;; - ld2.bias r2=[r31] - mov r3=65534 - ;; - adds r2=2,r2 - ;; - and r3=r3,r2 - ;; - st2.rel [r31]=r3 + st2.rel [r31]=r20 // release the lock #endif SSM_PSR_I(p0, p9, r17) ;;
Signature · 1 line
1.7.3.3
PATCH 141/260 KEYS: Fix RCU no-lock warning in keyctl_session_to_parent()
In reply to Paul GortmakerFrom: David Howells <[email protected]>
commit 9d1ac65a9698513d00e5608d93fca0c53f536c14 upstream.
There's an protected access to the parent process's credentials in the middle of keyctl_session_to_parent(). This results in the following RCU warning:
===================================================
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
security/keys/keyctl.c:1291 invoked rcu_dereference_check() without protection!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
1 lock held by keyctl-session-/2137:
#0: (tasklist_lock){.+.+..}, at: [<ffffffff811ae2ec>] keyctl_session_to_parent+0x60/0x236
stack backtrace: Pid: 2137, comm: keyctl-session- Not tainted 2.6.36-rc2-cachefs+ #1 Call Trace: [<ffffffff8105606a>] lockdep_rcu_dereference+0xaa/0xb3 [<ffffffff811ae379>] keyctl_session_to_parent+0xed/0x236 [<ffffffff811af77e>] sys_keyctl+0xb4/0xb6 [<ffffffff81001eab>] system_call_fastpath+0x16/0x1b
The code should take the RCU read lock to make sure the parents credentials don't go away, even though it's holding a spinlock and has IRQ disabled.
--- security/keys/keyctl.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
security/keys/keyctl.c +3 -0
@@ -1259,6 +1259,7 @@ long keyctl_session_to_parent(void) keyring_r =NULL ; me = current; +rcu_read_lock ();write_lock_irq (&tasklist_lock); parent = me->real_parent;
@@ -1313,6 +1314,7 @@ long keyctl_session_to_parent(void)set_ti_thread_flag (task_thread_info (parent),TIF_NOTIFY_RESUME );write_unlock_irq (&tasklist_lock); +rcu_read_unlock ();if (oldcred)put_cred (oldcred);return 0 ;
@@ -1321,6 +1323,7 @@ already_same: ret =0 ; not_permitted:write_unlock_irq (&tasklist_lock); +rcu_read_unlock ();put_cred (cred);return ret;
Signature · 1 line
1.7.3.3
PATCH 142/260 KEYS: Fix bug in keyctl_session_to_parent() if parent has no session keyring
In reply to Paul GortmakerFrom: David Howells <[email protected]>
commit 3d96406c7da1ed5811ea52a3b0905f4f0e295376 upstream.
Fix a bug in keyctl_session_to_parent() whereby it tries to check the ownership of the parent process's session keyring whether or not the parent has a session keyring [CVE-2010-2960].
This results in the following oops:
BUG: unable to handle kernel NULL pointer dereference at 00000000000000a0 IP: [<ffffffff811ae4dd>] keyctl_session_to_parent+0x251/0x443 ... Call Trace: [<ffffffff811ae2f3>] ? keyctl_session_to_parent+0x67/0x443 [<ffffffff8109d286>] ? __do_fault+0x24b/0x3d0 [<ffffffff811af98c>] sys_keyctl+0xb4/0xb8 [<ffffffff81001eab>] system_call_fastpath+0x16/0x1b
if the parent process has no session keyring.
If the system is using pam_keyinit then it mostly protected against this as all processes derived from a login will have inherited the session keyring created by pam_keyinit during the log in procedure.
To test this, pam_keyinit calls need to be commented out in /etc/pam.d/.
--- security/keys/keyctl.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
security/keys/keyctl.c +2 -1
@@ -1292,7 +1292,8 @@ long keyctl_session_to_parent(void) goto not_permitted;/* the keyrings must have the same UID */ -if (pcred ->tgcred->session_keyring->uid != mycred->euid || +if ((pcred->tgcred->session_keyring && + pcred->tgcred->session_keyring->uid != mycred->euid) || mycred->tgcred->session_keyring->uid != mycred->euid) goto not_permitted;
Signature · 1 line
1.7.3.3
PATCH 143/260 xfs: prevent reading uninitialized stack memory
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
commit a122eb2fdfd78b58c6dd992d6f4b1aaef667eef9 upstream.
The XFS_IOC_FSGETXATTR ioctl allows unprivileged users to read 12 bytes of uninitialized stack memory, because the fsxattr struct declared on the stack in xfs_ioc_fsgetxattr() does not alter (or zero) the 12-byte fsx_pad member before copying it back to the user. This patch takes care of it.
--- fs/xfs/linux-2.6/xfs_ioctl.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/xfs/linux-2.6/xfs_ioctl.c +2 -0
@@ -791,6 +791,8 @@ xfs_ioc_fsgetxattr( {struct fsxattr fa; +memset (&fa,0 ,sizeof (struct fsxattr )); +xfs_ilock (ip,XFS_ILOCK_SHARED ); fa.fsx_xflags =xfs_ip2xflags (ip); fa.fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
Signature · 1 line
1.7.3.3
PATCH 144/260 drivers/video/via/ioctl.c: prevent reading uninitialized stack memory
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
commit b4aaa78f4c2f9cde2f335b14f4ca30b01f9651ca upstream.
The VIAFB_GET_INFO device ioctl allows unprivileged users to read 246 bytes of uninitialized stack memory, because the "reserved" member of the viafb_ioctl_info struct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it.
--- drivers/video/via/ioctl.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/video/via/ioctl.c +2 -0
@@ -25,6 +25,8 @@ int viafb_ioctl_get_viafb_info(u_long arg) {struct viafb_ioctl_info viainfo; +memset (&viainfo,0 ,sizeof (struct viafb_ioctl_info )); + viainfo.viafb_id =VIAID ; viainfo.vendor_id =PCI_VIA_VENDOR_ID ;
Signature · 1 line
1.7.3.3
PATCH 145/260 AT91: change dma resource index
In reply to Paul GortmakerFrom: Nicolas Ferre <[email protected]>
commit 8d2602e0778299e2d6084f03086b716d6e7a1e1e upstream.
--- arch/arm/mach-at91/at91sam9g45_devices.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-at91/at91sam9g45_devices.c +1 -1
@@ -46,7 +46,7 @@ static struct resource hdmac_resources[] = { .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, .flags = IORESOURCE_MEM, }, - [2] = { + [1] = { .start = AT91SAM9G45_ID_DMA, .end = AT91SAM9G45_ID_DMA, .flags = IORESOURCE_IRQ,
Signature · 1 line
1.7.3.3
PATCH 146/260 mm: page allocator: drain per-cpu lists after direct reclaim allocation fails
In reply to Paul GortmakerFrom: Mel Gorman <[email protected]>
commit 9ee493ce0a60bf42c0f8fd0b0fe91df5704a1cbf upstream.
When under significant memory pressure, a process enters direct reclaim and immediately afterwards tries to allocate a page. If it fails and no further progress is made, it's possible the system will go OOM. However, on systems with large amounts of memory, it's possible that a significant number of pages are on per-cpu lists and inaccessible to the calling process. This leads to a process entering direct reclaim more often than it should increasing the pressure on the system and compounding the problem.
This patch notes that if direct reclaim is making progress but allocations are still failing that the system is already under heavy pressure. In this case, it drains the per-cpu lists and tries the allocation a second time before continuing.
--- mm/page_alloc.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
mm/page_alloc.c +16 -4
@@ -1703,6 +1703,7 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order,struct page *page =NULL ;struct reclaim_state reclaim_state;struct task_struct *p = current; +bool drained = false;cond_resched ();
@@ -1721,14 +1722,25 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order,cond_resched (); -if (order !=0 ) -drain_all_pages (); +if (unlikely (!(*did_some_progress))) +return NULL ; -if (likely (*did_some_progress)) - page =get_page_from_freelist (gfp_mask, nodemask, order, +retry: + page =get_page_from_freelist (gfp_mask, nodemask, order, zonelist, high_zoneidx, alloc_flags, preferred_zone, migratetype); + +/* +* If an allocation failed after direct reclaim, it could be because +* pages are pinned on the per-cpu lists. Drain them and try again +*/ +if (!page && !drained) { +drain_all_pages (); + drained = true; + goto retry; + } +return page; }
Signature · 1 line
1.7.3.3
PATCH 147/260 mm: page allocator: calculate a better estimate of NR_FREE_PAGES when memory is low and kswapd is awake
In reply to Paul GortmakerFrom: Christoph Lameter <[email protected]>
commit aa45484031ddee09b06350ab8528bfe5b2c76d1c upstream.
Ordinarily watermark checks are based on the vmstat NR_FREE_PAGES as it is cheaper than scanning a number of lists. To avoid synchronization overhead, counter deltas are maintained on a per-cpu basis and drained both periodically and when the delta is above a threshold. On large CPU systems, the difference between the estimated and real value of NR_FREE_PAGES can be very high. If NR_FREE_PAGES is much higher than number of real free page in buddy, the VM can allocate pages below min watermark, at worst reducing the real number of pages to zero. Even if the OOM killer kills some victim for freeing memory, it may not free memory if the exit path requires a new page resulting in livelock.
This patch introduces a zone_page_state_snapshot() function (courtesy of Christoph) that takes a slightly more accurate view of an arbitrary vmstat counter. It is used to read NR_FREE_PAGES while kswapd is awake to avoid the watermark being accidentally broken. The estimate is not perfect and may result in cache line bounces but is expected to be lighter than the IPI calls necessary to continually drain the per-cpu counters while kswapd is awake.
--- include/linux/mmzone.h | 13 +++++++++++++ include/linux/vmstat.h | 22 ++++++++++++++++++++++ mm/mmzone.c | 21 +++++++++++++++++++++ mm/page_alloc.c | 4 ++-- mm/vmstat.c | 15 ++++++++++++++- 5 files changed, 72 insertions(+), 3 deletions(-)
include/linux/mmzone.h +13 -0
@@ -284,6 +284,13 @@ struct zone {unsigned long watermark[NR_WMARK ];/* +* When free pages are below this point, additional steps are taken +* when reading the number of free pages to avoid per-cpu counter +* drift allowing watermarks to be breached +*/ +unsigned long percpu_drift_mark; + +/* * We don't know if the memory that we're going to allocate will be freeable * or/and it will be released eventually, so to avoid totally wasting several * GB of ram we must reserve some of the lower zone memory (otherwise we risk
@@ -447,6 +454,12 @@ static inline int zone_is_oom_locked(const struct zone *zone)return test_bit (ZONE_OOM_LOCKED , &zone->flags); } +#ifdef CONFIG_SMP +unsigned long zone_nr_free_pages (struct zone *zone); +#else +#define zone_nr_free_pages (zone) zone_page_state(zone, NR_FREE_PAGES) +#endif /* CONFIG_SMP */ +/* * The "priority" of VM scanning is how much of the queues we will scan in one * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
include/linux/vmstat.h +22 -0
@@ -166,6 +166,28 @@ static inline unsigned long zone_page_state(struct zone *zone,return x; } +/* +* More accurate version that also considers the currently pending +* deltas. For that we need to loop over all cpus to find the current +* deltas. There is no synchronization so the result cannot be +* exactly accurate either. +*/ +static inline unsigned long zone_page_state_snapshot (struct zone *zone, +enum zone_stat_item item) +{ +long x =atomic_long_read (&zone->vm_stat[item]); + +#ifdef CONFIG_SMP +int cpu; +for_each_online_cpu (cpu) + x +=per_cpu_ptr (zone->pageset, cpu)->vm_stat_diff[item]; + +if (x <0 ) + x =0 ; +#endif +return x; +} +extern unsigned long global_reclaimable_pages (void );extern unsigned long zone_reclaimable_pages (struct zone *zone);
mm/mmzone.c +21 -0
@@ -87,3 +87,24 @@ int memmap_valid_within(unsigned long pfn, return 1; }#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ + +#ifdef CONFIG_SMP +/* Called when a more accurate view of NR_FREE_PAGES is needed */ +unsigned long zone_nr_free_pages (struct zone *zone) +{ +unsigned long nr_free_pages =zone_page_state (zone,NR_FREE_PAGES ); + +/* +* While kswapd is awake, it is considered the zone is under some +* memory pressure. Under pressure, there is a risk that +* per-cpu-counter-drift will allow the min watermark to be breached +* potentially causing a live-lock. While kswapd is awake and +* free pages are low, get a better estimate for free pages +*/ +if (nr_free_pages < zone->percpu_drift_mark && + !waitqueue_active (&zone->zone_pgdat->kswapd_wait)) +return zone_page_state_snapshot (zone,NR_FREE_PAGES ); + +return nr_free_pages; +} +#endif /* CONFIG_SMP */
mm/page_alloc.c +2 -2
@@ -1377,7 +1377,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, {/* free_pages my go negative - that's OK */ long min = mark; -long free_pages =zone_page_state (z,NR_FREE_PAGES ) - (1 << order) +1 ; +long free_pages =zone_nr_free_pages (z) - (1 << order) +1 ;int o;if (alloc_flags &ALLOC_HIGH )
@@ -2271,7 +2271,7 @@ void show_free_areas(void)" all_unreclaimable? %s" "\n" , zone->name, -K (zone_page_state (zone,NR_FREE_PAGES )), +K (zone_nr_free_pages (zone)),K (min_wmark_pages (zone)),K (low_wmark_pages (zone)), K(high_wmark_pages(zone)),
mm/vmstat.c +14 -1
@@ -137,11 +137,24 @@ static void refresh_zone_stat_thresholds(void)int threshold;for_each_populated_zone (zone) { +unsigned long max_drift, tolerate_drift; + threshold =calculate_threshold (zone);for_each_online_cpu (cpu)per_cpu_ptr (zone->pageset, cpu)->stat_threshold = threshold; + +/* +* Only set percpu_drift_mark if there is a danger that +* NR_FREE_PAGES reports the low watermark is ok when in fact +* the min watermark could be breached by an allocation +*/ + tolerate_drift =low_wmark_pages (zone) -min_wmark_pages (zone); + max_drift =num_online_cpus () * threshold; +if (max_drift > tolerate_drift) + zone->percpu_drift_mark =high_wmark_pages (zone) + + max_drift; } }
@@ -721,7 +734,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,"\n scanned %lu" "\n spanned %lu" "\n present %lu" , -zone_page_state (zone,NR_FREE_PAGES ), +zone_nr_free_pages (zone),min_wmark_pages (zone),low_wmark_pages (zone), high_wmark_pages(zone),
Signature · 1 line
1.7.3.3
PATCH 148/260 mm: page allocator: update free page counters after pages are placed on the free list
In reply to Paul GortmakerFrom: Mel Gorman <[email protected]>
commit 72853e2991a2702ae93aaf889ac7db743a415dd3 upstream.
When allocating a page, the system uses NR_FREE_PAGES counters to determine if watermarks would remain intact after the allocation was made. This check is made without interrupts disabled or the zone lock held and so is race-prone by nature. Unfortunately, when pages are being freed in batch, the counters are updated before the pages are added on the list. During this window, the counters are misleading as the pages do not exist yet. When under significant pressure on systems with large numbers of CPUs, it's possible for processes to make progress even though they should have been stalled. This is particularly problematic if a number of the processes are using GFP_ATOMIC as the min watermark can be accidentally breached and in extreme cases, the system can livelock.
This patch updates the counters after the pages have been added to the list. This makes the allocator more cautious with respect to preserving the watermarks and mitigates livelock possibilities.
--- mm/page_alloc.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
mm/page_alloc.c +5 -4
@@ -551,13 +551,13 @@ static void free_pcppages_bulk(struct zone *zone, int count, {int migratetype =0 ;int batch_free =0 ; +int to_free = count;spin_lock (&zone->lock); zone->all_unreclaimable =0 ; zone->pages_scanned =0 ; -__mod_zone_page_state (zone,NR_FREE_PAGES , count); -while (count) { +while (to_free) {struct page *page;struct list_head *list;
@@ -582,8 +582,9 @@ static void free_pcppages_bulk(struct zone *zone, int count,/* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ __free_one_page (page, zone,0 ,page_private (page));trace_mm_page_pcpu_drain (page,0 ,page_private (page)); - }while (--count && --batch_free && !list_empty (list)); + }while (--to_free && --batch_free && !list_empty (list)); } +__mod_zone_page_state (zone,NR_FREE_PAGES , count);spin_unlock (&zone->lock); }
@@ -594,8 +595,8 @@ static void free_one_page(struct zone *zone, struct page *page, int order, zone->all_unreclaimable =0 ; zone->pages_scanned =0 ; -__mod_zone_page_state (zone,NR_FREE_PAGES ,1 << order);__free_one_page (page, zone, order, migratetype); +__mod_zone_page_state (zone,NR_FREE_PAGES ,1 << order);spin_unlock (&zone->lock); }
Signature · 1 line
1.7.3.3
PATCH 149/260 guard page for stacks that grow upwards
In reply to Paul GortmakerFrom: Luck, Tony <[email protected]>
commit 8ca3eb08097f6839b2206e2242db4179aee3cfb3 upstream.
pa-risc and ia64 have stacks that grow upwards. Check that they do not run into other mappings. By making VM_GROWSUP 0x0 on architectures that do not ever use it, we can avoid some unpleasant #ifdefs in check_stack_guard_page().
--- include/linux/mm.h | 8 +++++++- mm/memory.c | 15 +++++++++++---- mm/mmap.c | 3 --- 3 files changed, 18 insertions(+), 8 deletions(-)
include/linux/mm.h +7 -1
@@ -78,7 +78,11 @@ extern unsigned int kobjsize(const void *objp);#define VM_MAYSHARE 0x00000080#define VM_GROWSDOWN 0x00000100/* general info on the segment */ +#if defined(CONFIG_STACK_GROWSUP ) || defined(CONFIG_IA64 )#define VM_GROWSUP 0x00000200 +#else +#define VM_GROWSUP 0x00000000 +#endif #define VM_PFNMAP 0x00000400/* Page-ranges managed without "struct page", just pure PFN */ #define VM_DENYWRITE 0x00000800/* ETXTBSY on write attempts.. */
@@ -1325,8 +1329,10 @@ unsigned long ra_submit(struct file_ra_state *ra,/* Do stack extension */ extern int expand_stack (struct vm_area_struct *vma,unsigned long address); -#ifdef CONFIG_IA64 +#if VM_GROWSUP extern int expand_upwards (struct vm_area_struct *vma,unsigned long address); +#else +#define expand_upwards (vma, address) do { } while (0)#endif extern int expand_stack_downwards (struct vm_area_struct *vma,unsigned long address);
mm/memory.c +11 -4
@@ -2751,11 +2751,9 @@ out_release: }/* -* This is like a special single-page "expand_downwards()", -* except we must first make sure that 'address-PAGE_SIZE' +* This is like a special single-page "expand_{down|up}wards()", +* except we must first make sure that 'address{-|+}PAGE_SIZE' * doesn't hit another vma. -* -* The "find_vma()" will do the right thing even if we wrap */ static inline int check_stack_guard_page (struct vm_area_struct *vma,unsigned long address) {
@@ -2774,6 +2772,15 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned loexpand_stack (vma, address -PAGE_SIZE ); } +if ((vma->vm_flags &VM_GROWSUP ) && address +PAGE_SIZE == vma->vm_end) { +struct vm_area_struct *next = vma->vm_next; + +/* As VM_GROWSDOWN but s/below/above/ */ +if (next && next->vm_start == address +PAGE_SIZE ) +return next->vm_flags &VM_GROWSUP ?0 : -ENOMEM ; + +expand_upwards (vma, address +PAGE_SIZE ); + }return 0 ; }
mm/mmap.c +0 -3
@@ -1704,9 +1704,6 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns* PA-RISC uses this for its stack; IA64 for its Register Backing Store. * vma is the last one with address > vma->vm_end. Have to extend vma. */ -#ifndef CONFIG_IA64 -static -#endif int expand_upwards (struct vm_area_struct *vma,unsigned long address) {int error;
Signature · 1 line
1.7.3.3
PATCH 150/260 Fix unprotected access to task credentials in waitid()
In reply to Paul GortmakerFrom: Daniel J Blueman <[email protected]>
commit f362b73244fb16ea4ae127ced1467dd8adaa7733 upstream.
Using a program like the following:
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main() {
id_t id;
siginfo_t infop;
pid_t res;
id = fork();
if (id == 0) { sleep(1); exit(0); }
kill(id, SIGSTOP);
alarm(1);
waitid(P_PID, id, &infop, WCONTINUED);
return 0;
}to call waitid() on a stopped process results in access to the child task's credentials without the RCU read lock being held - which may be replaced in the meantime - eliciting the following warning:
===================================================
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
kernel/exit.c:1460 invoked rcu_dereference_check() without protection!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 1
2 locks held by waitid02/22252:
#0: (tasklist_lock){.?.?..}, at: [<ffffffff81061ce5>] do_wait+0xc5/0x310
#1: (&(&sighand->siglock)->rlock){-.-...}, at: [<ffffffff810611da>]
wait_consider_task+0x19a/0xbe0
stack backtrace:
Pid: 22252, comm: waitid02 Not tainted 2.6.35-323cd+ #3
Call Trace:
[<ffffffff81095da4>] lockdep_rcu_dereference+0xa4/0xc0
[<ffffffff81061b31>] wait_consider_task+0xaf1/0xbe0
[<ffffffff81061d15>] do_wait+0xf5/0x310
[<ffffffff810620b6>] sys_waitid+0x86/0x1f0
[<ffffffff8105fce0>] ? child_wait_callback+0x0/0x70
[<ffffffff81003282>] system_call_fastpath+0x16/0x1bThis is fixed by holding the RCU read lock in wait_task_continued() to ensure that the task's current credentials aren't destroyed between us reading the cred pointer and us reading the UID from those credentials.
Furthermore, protect wait_task_stopped() in the same way.
We don't need to keep holding the RCU read lock once we've read the UID from the credentials as holding the RCU read lock doesn't stop the target task from changing its creds under us - so the credentials may be outdated immediately after we've read the pointer, lock or no lock.
--- kernel/exit.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
kernel/exit.c +2 -3
@@ -1392,8 +1392,7 @@ static int wait_task_stopped(struct wait_opts *wo,if (!unlikely (wo->wo_flags &WNOWAIT )) *p_code =0 ; -/* don't need the RCU readlock here as we're holding a spinlock */ - uid =__task_cred (p)->uid; + uid =task_uid (p); unlock_sig:spin_unlock_irq (&p->sighand->siglock);if (!exit_code)
@@ -1466,7 +1465,7 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p) }if (!unlikely (wo->wo_flags &WNOWAIT )) p->signal->flags &= ~SIGNAL_STOP_CONTINUED ; - uid =__task_cred (p)->uid; + uid =task_uid (p);spin_unlock_irq (&p->sighand->siglock); pid =task_pid_vnr (p);
Signature · 1 line
1.7.3.3
PATCH 151/260 sctp: Do not reset the packet during sctp_packet_config().
In reply to Paul GortmakerFrom: Vlad Yasevich <[email protected]>
commit 4bdab43323b459900578b200a4b8cf9713ac8fab upstream.
sctp_packet_config() is called when getting the packet ready for appending of chunks. The function should not touch the current state, since it's possible to ping-pong between two transports when sending, and that can result packet corruption followed by skb overlfow crash.
--- net/sctp/output.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
net/sctp/output.c +0 -1
@@ -92,7 +92,6 @@ struct sctp_packet *sctp_packet_config(struct sctp_packet *packet,SCTP_DEBUG_PRINTK ("%s: packet:%p vtag:0x%x\n" , __func__, packet, vtag); -sctp_packet_reset (packet); packet->vtag = vtag;if (ecn_capable &&sctp_packet_empty (packet)) {
Signature · 1 line
1.7.3.3
PATCH 152/260 dasd: use correct label location for diag fba disks
In reply to Paul GortmakerFrom: Peter Oberparleiter <[email protected]>
commit cffab6bc5511cd6f67a60bf16b62de4267b68c4c upstream.
Partition boundary calculation fails for DASD FBA disks under the following conditions:
- disk is formatted with CMS FORMAT with a blocksize of more than 512 bytes
- all of the disk is reserved to a single CMS file using CMS RESERVE
- the disk is accessed using the DIAG mode of the DASD driver
Under these circumstances, the partition detection code tries to read the CMS label block containing partition-relevant information from logical block offset 1, while it is in fact located at physical block offset 1.
Fix this problem by using the correct CMS label block location depending on the device type as determined by the DASD SENSE ID information.
--- fs/partitions/ibm.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
fs/partitions/ibm.c +12 -1
@@ -74,6 +74,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) } *label;unsigned char *data;Sector sect; +sector_t labelsect; res =0 ; blocksize =bdev_logical_block_size (bdev);
@@ -98,9 +99,19 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) goto out_freeall;/* +* Special case for FBA disks: label sector does not depend on +* blocksize. +*/ +if ((info->cu_type ==0x6310 && info->dev_type ==0x9336 ) || + (info->cu_type ==0x3880 && info->dev_type ==0x3370 )) + labelsect = info->label_block; +else + labelsect = info->label_block * (blocksize >>9 ); + +/* * Get volume label, extract name and type. */ - data =read_dev_sector (bdev, info->label_block*(blocksize/512 ), §); + data =read_dev_sector (bdev, labelsect, §);if (data ==NULL ) goto out_readerr;
Signature · 1 line
1.7.3.3
PATCH 153/260 hostap_pci: set dev->base_addr during probe
In reply to Paul GortmakerFrom: John W. Linville <[email protected]>
commit 0f4da2d77e1bf424ac36424081afc22cbfc3ff2b upstream.
"hostap: Protect against initialization interrupt" (which reinstated "wireless: hostap, fix oops due to early probing interrupt") reintroduced Bug 16111. This is because hostap_pci wasn't setting dev->base_addr, which is now checked in prism2_interrupt. As a result, initialization was failing for PCI-based hostap devices. This corrects that oversight.
--- drivers/net/wireless/hostap/hostap_pci.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/hostap/hostap_pci.c +1 -0
@@ -330,6 +330,7 @@ static int prism2_pci_probe(struct pci_dev *pdev, dev->irq = pdev->irq; hw_priv->mem_start = mem; + dev->base_addr = (unsigned long ) mem;prism2_pci_cor_sreset (local);
Signature · 1 line
1.7.3.3
PATCH 154/260 inotify: fix inotify oneshot support
In reply to Paul GortmakerFrom: Eric Paris <[email protected]>
commit ff311008ab8d2f2cfdbbefd407d1b05acc8164b2 upstream.
During the large inotify rewrite to fsnotify I completely dropped support for IN_ONESHOT. Reimplement that support.
--- fs/notify/inotify/inotify_fsnotify.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
fs/notify/inotify/inotify_fsnotify.c +3 -0
@@ -72,6 +72,9 @@ static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_ev ret =0 ; } +if (entry->mask &IN_ONESHOT ) +fsnotify_destroy_mark_by_entry (entry); +/* * If we hold the entry until after the event is on the queue * IN_IGNORED won't be able to pass this event in the queue
Signature · 1 line
1.7.3.3
PATCH 155/260 MIPS: Quit using undefined behavior of ADDU in 64-bit atomic operations.
In reply to Paul GortmakerFrom: David Daney <[email protected]>
commit f2a68272d799bf4092443357142f63b74f7669a1 upstream.
For 64-bit, we must use DADDU and DSUBU.
To: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/1483/
--- arch/mips/include/asm/atomic.h | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
arch/mips/include/asm/atomic.h +12 -12
@@ -434,7 +434,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v) __asm__ __volatile__(" .set mips3 \n" "1: lld %0, %1 # atomic64_add \n" -" addu %0, %2 \n" +" daddu %0, %2 \n" " scd %0, %1 \n" " beqzl %0, 1b \n" " .set mips0 \n"
@@ -446,7 +446,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v) __asm__ __volatile__(" .set mips3 \n" "1: lld %0, %1 # atomic64_add \n" -" addu %0, %2 \n" +" daddu %0, %2 \n" " scd %0, %1 \n" " beqz %0, 2f \n" " .subsection 2 \n"
@@ -479,7 +479,7 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v) __asm__ __volatile__(" .set mips3 \n" "1: lld %0, %1 # atomic64_sub \n" -" subu %0, %2 \n" +" dsubu %0, %2 \n" " scd %0, %1 \n" " beqzl %0, 1b \n" " .set mips0 \n"
@@ -491,7 +491,7 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v) __asm__ __volatile__(" .set mips3 \n" "1: lld %0, %1 # atomic64_sub \n" -" subu %0, %2 \n" +" dsubu %0, %2 \n" " scd %0, %1 \n" " beqz %0, 2f \n" " .subsection 2 \n"
@@ -524,10 +524,10 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v) __asm__ __volatile__(" .set mips3 \n" "1: lld %1, %2 # atomic64_add_return \n" -" addu %0, %1, %3 \n" +" daddu %0, %1, %3 \n" " scd %0, %2 \n" " beqzl %0, 1b \n" -" addu %0, %1, %3 \n" +" daddu %0, %1, %3 \n" " .set mips0 \n" :"=&r" (result),"=&r" (temp),"=m" (v->counter) : "Ir" (i), "m" (v->counter)
@@ -538,10 +538,10 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v) __asm__ __volatile__(" .set mips3 \n" "1: lld %1, %2 # atomic64_add_return \n" -" addu %0, %1, %3 \n" +" daddu %0, %1, %3 \n" " scd %0, %2 \n" " beqz %0, 2f \n" -" addu %0, %1, %3 \n" +" daddu %0, %1, %3 \n" " .subsection 2 \n" "2: b 1b \n" " .previous \n"
@@ -576,10 +576,10 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) __asm__ __volatile__(" .set mips3 \n" "1: lld %1, %2 # atomic64_sub_return \n" -" subu %0, %1, %3 \n" +" dsubu %0, %1, %3 \n" " scd %0, %2 \n" " beqzl %0, 1b \n" -" subu %0, %1, %3 \n" +" dsubu %0, %1, %3 \n" " .set mips0 \n" :"=&r" (result),"=&r" (temp),"=m" (v->counter) : "Ir" (i), "m" (v->counter)
@@ -590,10 +590,10 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) __asm__ __volatile__(" .set mips3 \n" "1: lld %1, %2 # atomic64_sub_return \n" -" subu %0, %1, %3 \n" +" dsubu %0, %1, %3 \n" " scd %0, %2 \n" " beqz %0, 2f \n" -" subu %0, %1, %3 \n" +" dsubu %0, %1, %3 \n" " .subsection 2 \n" "2: b 1b \n" " .previous \n"
Signature · 1 line
1.7.3.3
PATCH 156/260 MIPS: Set io_map_base for several PCI bridges lacking it
In reply to Paul GortmakerFrom: Ben Hutchings <[email protected]>
commit 8faf2e6c201d95b780cd3b4674b7a55ede6dcbbb upstream.
Several MIPS platforms don't set pci_controller::io_map_base for their PCI bridges. This results in a panic in pci_iomap(). (The panic is conditional on CONFIG_PCI_DOMAINS, but that is now enabled for all PCI MIPS systems.)
Patchwork: https://patchwork.linux-mips.org/patch/1377/
--- arch/mips/mti-malta/malta-pci.c | 2 ++ arch/mips/nxp/pnx8550/common/pci.c | 1 + arch/mips/nxp/pnx8550/common/setup.c | 2 +- arch/mips/pci/ops-pmcmsp.c | 1 + arch/mips/pci/pci-yosemite.c | 1 + 5 files changed, 6 insertions(+), 1 deletions(-)
arch/mips/mti-malta/malta-pci.c +2 -0
@@ -247,6 +247,8 @@ void __init mips_pcibios_init(void) iomem_resource.end &=0xfffffffffULL ;/* 64 GB */ ioport_resource.end = controller->io_resource->end; + controller->io_map_base = mips_io_port_base; +register_pci_controller (controller); }
arch/mips/nxp/pnx8550/common/pci.c +1 -0
@@ -44,6 +44,7 @@ extern struct pci_ops pnx8550_pci_ops;static struct pci_controller pnx8550_controller = { .pci_ops = &pnx8550_pci_ops, + .io_map_base =PNX8550_PORT_BASE , .io_resource = &pci_io_resource, .mem_resource = &pci_mem_resource, };
arch/mips/nxp/pnx8550/common/setup.c +1 -1
@@ -113,7 +113,7 @@ void __init plat_mem_setup(void)PNX8550_GLB2_ENAB_INTA_O =0 ;/* IO/MEM resources. */ -set_io_port_base (KSEG1 ); +set_io_port_base (PNX8550_PORT_BASE ); ioport_resource.start =0 ; ioport_resource.end = ~0 ; iomem_resource.start =0 ;
arch/mips/pci/ops-pmcmsp.c +1 -0
@@ -944,6 +944,7 @@ static struct pci_controller msp_pci_controller = { .pci_ops = &msp_pci_ops, .mem_resource = &pci_mem_resource, .mem_offset = 0, + .io_map_base = MSP_PCI_IOSPACE_BASE, .io_resource = &pci_io_resource, .io_offset = 0 };
arch/mips/pci/pci-yosemite.c +1 -0
@@ -54,6 +54,7 @@ static int __init pmc_yosemite_setup(void)panic (ioremap_failed);set_io_port_base (io_v_base); + py_controller.io_map_base = io_v_base;TITAN_WRITE (RM9000x2_OCD_LKM7,TITAN_READ (RM9000x2_OCD_LKM7) |1 ); ioport_resource.end =TITAN_IO_SIZE -1 ;
Signature · 1 line
1.7.3.3
PATCH 157/260 sis-agp: Remove SIS 760, handled by amd64-agp
In reply to Paul GortmakerFrom: Ben Hutchings <[email protected]>
commit d831692a1a8e9ceaaa9bb16bb3fc503b7e372558 upstream.
SIS 760 is listed in the device tables for both amd64-agp and sis-agp. amd64-agp is apparently preferable since it has workarounds for some BIOS misconfigurations that sis-agp doesn't handle.
--- drivers/char/agp/sis-agp.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/char/agp/sis-agp.c +0 -8
@@ -415,14 +415,6 @@ static struct pci_device_id agp_sis_pci_table[] = { .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, - { - .class = (PCI_CLASS_BRIDGE_HOST << 8), - .class_mask = ~0, - .vendor = PCI_VENDOR_ID_SI, - .device = PCI_DEVICE_ID_SI_760, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, { } };
Signature · 1 line
1.7.3.3
PATCH 158/260 alpha: Fix printk format errors
In reply to Paul GortmakerFrom: Michael Cree <[email protected]>
commit 3e073367a57d41e506f20aebb98e308387ce3090 upstream.
When compiling alpha generic build get errors such as:arch/alpha/kernel/err_marvel.c: In function ‘marvel_print_err_cyc’:arch/alpha/kernel/err_marvel.c:119: error: format ‘%ld’ expects type ‘long int’, but argument 6 has type ‘u64’
Replaced a number of %ld format specifiers with %lld since u64 is unsigned long long.
--- arch/alpha/kernel/err_marvel.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/alpha/kernel/err_marvel.c +3 -3
@@ -109,7 +109,7 @@ marvel_print_err_cyc(u64 err_cyc)#define IO7__ERR_CYC__CYCLE__M (0x7) printk("%s Packet In Error: %s\n" - "%s Error in %s, cycle %ld%s%s\n", + "%s Error in %s, cycle %lld%s%s\n", err_print_prefix, packet_desc[EXTRACT(err_cyc, IO7__ERR_CYC__PACKET)], err_print_prefix,
@@ -313,7 +313,7 @@ marvel_print_po7_ugbge_sym(u64 ugbge_sym) } printk("%s Up Hose Garbage Symptom:\n" - "%s Source Port: %ld - Dest PID: %ld - OpCode: %s\n", + "%s Source Port: %lld - Dest PID: %lld - OpCode: %s\n", err_print_prefix, err_print_prefix, EXTRACT(ugbge_sym, IO7__PO7_UGBGE_SYM__UPH_SRC_PORT),
@@ -552,7 +552,7 @@ marvel_print_pox_spl_cmplt(u64 spl_cmplt)#define IO7__POX_SPLCMPLT__REM_BYTE_COUNT__M (0xfff) printk("%s Split Completion Error:\n" - "%s Source (Bus:Dev:Func): %ld:%ld:%ld\n", + "%s Source (Bus:Dev:Func): %lld:%lld:%lld\n", err_print_prefix, err_print_prefix, EXTRACT(spl_cmplt, IO7__POX_SPLCMPLT__SOURCE_BUS),
Signature · 1 line
1.7.3.3