v2.6.34.8 longterm review
Subsystems (108)
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
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
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 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 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 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 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 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 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 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 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 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 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 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 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 159/260 x86, cpu: After uncapping CPUID, re-run CPU feature detection
In reply to Paul GortmakerFrom: H. Peter Anvin <[email protected]>
commit d900329e20f4476db6461752accebcf7935a8055 upstream.
After uncapping the CPUID level, we need to also re-run the CPU feature detection code.
This resolves kernel bugzilla 16322.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/cpu.h | 1 + arch/x86/kernel/cpu/intel.c | 1 + 3 files changed, 3 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/common.c +1 -1
@@ -537,7 +537,7 @@ void __cpuinit cpu_detect(struct cpuinfo_x86 *c) } } -static void __cpuinit get_cpu_cap (struct cpuinfo_x86 *c) +void __cpuinit get_cpu_cap (struct cpuinfo_x86 *c) {u32 tfms, xlvl;u32 ebx;
arch/x86/kernel/cpu/cpu.h +1 -0
@@ -33,5 +33,6 @@ extern const struct cpu_dev *const __x86_cpu_dev_start[], *const __x86_cpu_dev_end[];extern void cpu_detect_cache_sizes (struct cpuinfo_x86 *c); +extern void get_cpu_cap (struct cpuinfo_x86 *c);#endif
arch/x86/kernel/cpu/intel.c +1 -0
@@ -40,6 +40,7 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID ;wrmsrl (MSR_IA32_MISC_ENABLE , misc_enable); c->cpuid_level =cpuid_eax (0 ); +get_cpu_cap (c); } }
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 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 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 169/260 RDMA/cxgb3: Turn off RX coalescing for iWARP connections
In reply to Paul GortmakerFrom: Steve Wise <[email protected]>
commit bec658ff31453a5726b1c188674d587a5d40c482 upstream.
The HW by default has RX coalescing on. For iWARP connections, this causes a 100ms delay in connection establishement due to the ingress MPA Start message being stalled in HW. So explicitly turn RX coalescing off when setting up iWARP connections.
This was causing very bad performance for NP64 gather operations using Open MPI, due to the way it sets up connections on larger jobs.
--- drivers/infiniband/hw/cxgb3/iwch_cm.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_cm.c +4 -2
@@ -487,7 +487,8 @@ static int send_connect(struct iwch_ep *ep)V_MSS_IDX (mtu_idx) |V_L2T_IDX (ep->l2t->idx) |V_TX_CHANNEL (ep->l2t->smt_idx); opt0l =V_TOS ((ep->tos >>2 ) &M_TOS ) |V_RCV_BUFSIZ (rcv_win>>10 ); - opt2 =V_FLAVORS_VALID (1 ) |V_CONG_CONTROL_FLAVOR (cong_flavor); + opt2 =F_RX_COALESCE_VALID |V_RX_COALESCE (0 ) |V_FLAVORS_VALID (1 ) | +V_CONG_CONTROL_FLAVOR (cong_flavor); skb->priority =CPL_PRIORITY_SETUP ;set_arp_failure_handler (skb, act_open_req_arp_failure);
@@ -1304,7 +1305,8 @@ static void accept_cr(struct iwch_ep *ep, __be32 peer_ip, struct sk_buff *skb)V_MSS_IDX (mtu_idx) |V_L2T_IDX (ep->l2t->idx) |V_TX_CHANNEL (ep->l2t->smt_idx); opt0l =V_TOS ((ep->tos >>2 ) &M_TOS ) |V_RCV_BUFSIZ (rcv_win>>10 ); - opt2 =V_FLAVORS_VALID (1 ) |V_CONG_CONTROL_FLAVOR (cong_flavor); + opt2 =F_RX_COALESCE_VALID |V_RX_COALESCE (0 ) |V_FLAVORS_VALID (1 ) | +V_CONG_CONTROL_FLAVOR (cong_flavor); rpl =cplhdr (skb); rpl->wr.wr_hi =htonl (V_WR_OP (FW_WROPCODE_FORWARD ));
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 171/260 x86/amd-iommu: Set iommu configuration flags in enable-loop
In reply to Paul GortmakerFrom: Joerg Roedel <[email protected]>
commit e9bf51971157e367aabfc111a8219db010f69cd4 upstream.
This patch moves the setting of the configuration and feature flags out out the acpi table parsing path and moves it into the iommu-enable path. This is needed to reliably fix resume-from-s3.
--- arch/x86/include/asm/amd_iommu_types.h | 3 ++ arch/x86/kernel/amd_iommu_init.c | 49 +++++++++++++++++-------------- 2 files changed, 30 insertions(+), 22 deletions(-)
arch/x86/include/asm/amd_iommu_types.h +3 -0
@@ -334,6 +334,9 @@ struct amd_iommu {/* capabilities of that IOMMU read from ACPI */ u32 cap; +/* flags read from acpi table */ +u8 acpi_flags; +/* * Capability pointer. There could be more than one IOMMU per PCI * device function if there are more than one AMD IOMMU capability
arch/x86/kernel/amd_iommu_init.c +27 -22
68 lines not on this page · raw message
Signature · 1 line
1.7.3.3
PATCH 174/260 tracing/x86: Don't use mcount in pvclock.c
In reply to Paul GortmakerFrom: Jeremy Fitzhardinge <[email protected]>
commit 9ecd4e1689208afe9b059a5ce1333acb2f42c4d2 upstream.
When using a paravirt clock, pvclock.c can be used by sched_clock(), which in turn is used by the tracing mechanism for timestamps, which leads to infinite recursion.
Disable mcount/tracing for pvclock.o.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/Makefile | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kernel/Makefile +1 -0
@@ -11,6 +11,7 @@ ifdef CONFIG_FUNCTION_TRACER CFLAGS_REMOVE_tsc.o = -pg CFLAGS_REMOVE_rtc.o = -pg CFLAGS_REMOVE_paravirt-spinlocks.o = -pg +CFLAGS_REMOVE_pvclock.o = -pg CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_early_printk.o = -pg endif
Signature · 1 line
1.7.3.3
PATCH 177/260 V4L/DVB: cx231xx: Avoid an OOPS when card is unknown (card=0)
In reply to Paul GortmakerFrom: Mauro Carvalho Chehab <[email protected]>
commit c10469c637602c2385e2993d8c730cc44fd47d23 upstream.
As reported by: Carlos Americo Domiciano <[email protected]>:
[ 220.033500] cx231xx v4l2 driver loaded. [ 220.033571] cx231xx #0: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 6 interfaces [ 220.033577] cx231xx #0: registering interface 0 [ 220.033591] cx231xx #0: registering interface 1 [ 220.033654] cx231xx #0: registering interface 6 [ 220.033910] cx231xx #0: Identified as Unknown CX231xx video grabber (card=0) [ 220.033946] BUG: unable to handle kernel NULL pointer dereference at (null) [ 220.033955] IP: [<ffffffffa0d3c8bd>] cx231xx_pre_card_setup+0x5d/0xb0 [cx231xx]
Thanks-to: Carlos Americo Domiciano <[email protected]>
--- drivers/media/video/cx231xx/cx231xx-cards.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
drivers/media/video/cx231xx/cx231xx-cards.c +8 -6
@@ -226,14 +226,16 @@ void cx231xx_pre_card_setup(struct cx231xx *dev) dev->board.name, dev->model);/* set the direction for GPIO pins */ -cx231xx_set_gpio_direction (dev, dev->board.tuner_gpio->bit,1 ); -cx231xx_set_gpio_value (dev, dev->board.tuner_gpio->bit,1 ); -cx231xx_set_gpio_direction (dev, dev->board.tuner_sif_gpio,1 ); +if (dev->board.tuner_gpio) { +cx231xx_set_gpio_direction (dev, dev->board.tuner_gpio->bit,1 ); +cx231xx_set_gpio_value (dev, dev->board.tuner_gpio->bit,1 ); +cx231xx_set_gpio_direction (dev, dev->board.tuner_sif_gpio,1 ); -/* request some modules if any required */ +/* request some modules if any required */ -/* reset the Tuner */ -cx231xx_gpio_set (dev, dev->board.tuner_gpio); +/* reset the Tuner */ +cx231xx_gpio_set (dev, dev->board.tuner_gpio); + }/* set the mode to Analog mode initially */ cx231xx_set_mode (dev,CX231XX_ANALOG_MODE );
Signature · 1 line
1.7.3.3
PATCH 188/260 atl1: fix resume
In reply to Paul GortmakerFrom: Luca Tettamanti <[email protected]>
commit ec5a32f67c603b11d68eb283d94eb89a4f6cfce1 upstream.
adapter->cmb.cmb is initialized when the device is opened and freed when it's closed. Accessing it unconditionally during resume results either in a crash (NULL pointer dereference, when the interface has not been opened yet) or data corruption (when the interface has been used and brought down adapter->cmb.cmb points to a deallocated memory area).
--- drivers/net/atlx/atl1.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/atlx/atl1.c +3 -2
@@ -2849,10 +2849,11 @@ static int atl1_resume(struct pci_dev *pdev)pci_enable_wake (pdev, PCI_D3cold,0 );atl1_reset_hw (&adapter->hw); - adapter->cmb.cmb->int_stats =0 ; -if (netif_running (netdev)) +if (netif_running (netdev)) { + adapter->cmb.cmb->int_stats =0 ;atl1_up (adapter); + }netif_device_attach (netdev);return 0 ;
Signature · 1 line
1.7.3.3
PATCH 187/260 wext: fix potential private ioctl memory content leak
In reply to Paul GortmakerFrom: Johannes Berg <[email protected]>
commit df6d02300f7c2fbd0fbe626d819c8e5237d72c62 upstream.
When a driver doesn't fill the entire buffer, old heap contents may remain, and if it also doesn't update the length properly, this old heap content will be copied back to userspace.
It is very unlikely that this happens in any of the drivers using private ioctls since it would show up as junk being reported by iwpriv, but it seems better to be safe here, so use kzalloc.
--- net/wireless/wext-priv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/wireless/wext-priv.c +1 -1
@@ -152,7 +152,7 @@ static int ioctl_private_iw_point(struct iw_point *iwp, unsigned int cmd, }else if (!iwp->pointer)return -EFAULT ; - extra =kmalloc (extra_size,GFP_KERNEL ); + extra =kzalloc (extra_size,GFP_KERNEL );if (!extra)return -ENOMEM ;
Signature · 1 line
1.7.3.3
PATCH 194/260 net: Fix the condition passed to sk_wait_event()
In reply to Paul GortmakerFrom: Nagendra Tomar <[email protected]>
commit 482964e56e1320cb7952faa1932d8ecf59c4bf75 upstream.
This patch fixes the condition (3rd arg) passed to sk_wait_event() in sk_stream_wait_memory(). The incorrect check in sk_stream_wait_memory() causes the following soft lockup in tcp_sendmsg() when the global tcp memory pool has exhausted.
Quoted 1 line
Quoted 1 line
Quoted 1 line
snip <<<
localhost kernel: BUG: soft lockup - CPU#3 stuck for 11s! [sshd:6429]
localhost kernel: CPU 3:
localhost kernel: RIP: 0010:[sk_stream_wait_memory+0xcd/0x200] [sk_stream_wait_memory+0xcd/0x200] sk_stream_wait_memory+0xcd/0x200 localhost kernel:
localhost kernel: Call Trace: localhost kernel: [sk_stream_wait_memory+0x1b1/0x200] sk_stream_wait_memory+0x1b1/0x200 localhost kernel: [<ffffffff802557c0>] autoremove_wake_function+0x0/0x40 localhost kernel: [ipv6:tcp_sendmsg+0x6e6/0xe90] tcp_sendmsg+0x6e6/0xce0 localhost kernel: [sock_aio_write+0x126/0x140] sock_aio_write+0x126/0x140 localhost kernel: [xfs:do_sync_write+0xf1/0x130] do_sync_write+0xf1/0x130 localhost kernel: [<ffffffff802557c0>] autoremove_wake_function+0x0/0x40 localhost kernel: [hrtimer_start+0xe3/0x170] hrtimer_start+0xe3/0x170 localhost kernel: [vfs_write+0x185/0x190] vfs_write+0x185/0x190 localhost kernel: [sys_write+0x50/0x90] sys_write+0x50/0x90 localhost kernel: [system_call+0x7e/0x83] system_call+0x7e/0x83
Quoted 1 line
Quoted 1 line
Quoted 1 line
snip <<<
What is happening is, that the sk_wait_event() condition passed from sk_stream_wait_memory() evaluates to true for the case of tcp global memory exhaustion. This is because both sk_stream_memory_free() and vm_wait are true which causes sk_wait_event() to *not* call schedule_timeout(). Hence sk_stream_wait_memory() returns immediately to the caller w/o sleeping. This causes the caller to again try allocation, which again fails and again calls sk_stream_wait_memory(), and so on.
[ Bug introduced by commit c1cbe4b7ad0bc4b1d98ea708a3fecb7362aa4088
("[NET]: Avoid atomic xchg() for non-error case") -DaveM ]
--- net/core/stream.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
net/core/stream.c +4 -4
@@ -140,10 +140,10 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); sk->sk_write_pending++; -sk_wait_event (sk, ¤t_timeo, !sk->sk_err && - !(sk->sk_shutdown &SEND_SHUTDOWN ) && -sk_stream_memory_free (sk) && - vm_wait); +sk_wait_event (sk, ¤t_timeo, sk->sk_err || + (sk->sk_shutdown &SEND_SHUTDOWN ) || + (sk_stream_memory_free (sk) && + !vm_wait)); sk->sk_write_pending--;if (vm_wait) {
Signature · 1 line
1.7.3.3
PATCH 180/260 x86, irq: Plug memory leak in sparse irq
In reply to Paul GortmakerFrom: Thomas Gleixner <[email protected]>
commit 1cf180c94e9166cda083ff65333883ab3648e852 upstream.
free_irq_cfg() is not freeing the cpumask_vars in irq_cfg. Fixing this triggers a use after free caused by the fact that copying struct irq_cfg is done with memcpy, which copies the pointer not the cpumask.
Fix both places.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/io_apic.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/io_apic.c +8 -3
@@ -303,14 +303,19 @@ void arch_init_copy_chip_data(struct irq_desc *old_desc, old_cfg = old_desc->chip_data; -memcpy (cfg, old_cfg,sizeof (struct irq_cfg )); + cfg->vector = old_cfg->vector; + cfg->move_in_progress = old_cfg->move_in_progress; +cpumask_copy (cfg->domain, old_cfg->domain); +cpumask_copy (cfg->old_domain, old_cfg->old_domain);init_copy_irq_2_pin (old_cfg, cfg, node); } -static void free_irq_cfg (struct irq_cfg *old_cfg) +static void free_irq_cfg (struct irq_cfg *cfg) { -kfree (old_cfg); +free_cpumask_var (cfg->domain); +free_cpumask_var (cfg->old_domain); +kfree (cfg); }void arch_free_chip_data (struct irq_desc *old_desc,struct irq_desc *desc)
Signature · 1 line
1.7.3.3
PATCH 199/260 tcp: Fix race in tcp_poll
In reply to Paul GortmakerFrom: Tom Marshall <[email protected]>
commit a4d258036ed9b2a1811c3670c6099203a0f284a0 upstream.
If a RST comes in immediately after checking sk->sk_err, tcp_poll will return POLLIN but not POLLOUT. Fix this by checking sk->sk_err at the end of tcp_poll. Additionally, ensure the correct order of operations on SMP machines with memory barriers.
--- net/ipv4/tcp.c | 7 +++++-- net/ipv4/tcp_input.c | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-)
net/ipv4/tcp.c +5 -2
@@ -388,8 +388,6 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)*/ mask =0 ; -if (sk->sk_err) - mask =POLLERR ;/* * POLLHUP is certainly not done right. But poll() doesn't
@@ -459,6 +457,11 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)if (tp->urg_data &TCP_URG_VALID ) mask |=POLLPRI ; } +/* This barrier is coupled with smp_wmb() in tcp_reset() */ +smp_rmb (); +if (sk->sk_err) + mask |=POLLERR ; +return mask; }
net/ipv4/tcp_input.c +2 -0
@@ -4040,6 +4040,8 @@ static void tcp_reset(struct sock *sk)default : sk->sk_err =ECONNRESET ; } +/* This barrier is coupled with smp_rmb() in tcp_poll() */ +smp_wmb ();if (!sock_flag (sk,SOCK_DEAD )) sk->sk_error_report (sk);
Signature · 1 line
1.7.3.3
PATCH 195/260 Phonet: Correct header retrieval after pskb_may_pull
In reply to Paul GortmakerFrom: Kumar Sanghvi <[email protected]>
commit a91e7d471e2e384035b9746ea707ccdcd353f5dd upstream.
Retrieve the header after doing pskb_may_pull since, pskb_may_pull could change the buffer structure.
This is based on the comment given by Eric Dumazet on Phonet Pipe controller patch for a similar problem.
--- net/phonet/pep.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/phonet/pep.c +2 -1
@@ -225,12 +225,13 @@ static void pipe_grant_credits(struct sock *sk)static int pipe_rcv_status (struct sock *sk,struct sk_buff *skb) {struct pep_sock *pn =pep_sk (sk); -struct pnpipehdr *hdr =pnp_hdr (skb); +struct pnpipehdr *hdr;int wake =0 ;if (!pskb_may_pull (skb,sizeof (*hdr) +4 ))return -EINVAL ; + hdr =pnp_hdr (skb);if (hdr->data[0 ] !=PN_PEP_TYPE_COMMON ) {LIMIT_NETDEBUG (KERN_DEBUG "Phonet unknown PEP type: %u\n" , (unsigned )hdr->data[0 ]);
Signature · 1 line
1.7.3.3
PATCH 200/260 netxen: dont set skb->truesize
In reply to Paul GortmakerFrom: Eric Dumazet <[email protected]>
commit 7e96dc7045bff8758804b047c0dfb6868f182500 upstream.
skb->truesize is set in core network.
Dont change it unless dealing with fragments.
--- drivers/net/netxen/netxen_nic_init.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/net/netxen/netxen_nic_init.c +0 -3
@@ -1402,7 +1402,6 @@ netxen_process_rcv(struct netxen_adapter *adapter,if (pkt_offset)skb_pull (skb, pkt_offset); - skb->truesize = skb->len +sizeof (struct sk_buff ); skb->protocol =eth_type_trans (skb, netdev);napi_gro_receive (&sds_ring->napi, skb);
@@ -1464,8 +1463,6 @@ netxen_process_lro(struct netxen_adapter *adapter,skb_put (skb, lro_length + data_offset); - skb->truesize = skb->len +sizeof (struct sk_buff ) +skb_headroom (skb); -skb_pull (skb, l2_hdr_offset); skb->protocol =eth_type_trans (skb, netdev);
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 201/260 rose: Fix signedness issues wrt. digi count.
In reply to Paul GortmakerFrom: David S. Miller <[email protected]>
commit 9828e6e6e3f19efcb476c567b9999891d051f52f upstream.
Just use explicit casts, since we really can't change the types of structures exported to userspace which have been around for 15 years or so.
--- net/rose/af_rose.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/rose/af_rose.c +2 -2
@@ -679,7 +679,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)if (addr_len ==sizeof (struct sockaddr_rose ) && addr->srose_ndigis >1 )return -EINVAL ; -if (addr->srose_ndigis >ROSE_MAX_DIGIS ) +if ((unsigned int ) addr->srose_ndigis >ROSE_MAX_DIGIS )return -EINVAL ;if ((dev =rose_dev_get (&addr->srose_addr)) ==NULL ) {
@@ -739,7 +739,7 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_leif (addr_len ==sizeof (struct sockaddr_rose ) && addr->srose_ndigis >1 )return -EINVAL ; -if (addr->srose_ndigis >ROSE_MAX_DIGIS ) +if ((unsigned int ) addr->srose_ndigis >ROSE_MAX_DIGIS )return -EINVAL ;/* Source + Destination digis should not exceed ROSE_MAX_DIGIS */
Signature · 1 line
1.7.3.3
PATCH 208/260 b44: fix carrier detection on bind
In reply to Paul GortmakerFrom: Paul Fertser <[email protected]>
commit bcf64aa379fcadd074449cbf0c049da70071b06f upstream.
For carrier detection to work properly when binding the driver with a cable unplugged, netif_carrier_off() should be called after register_netdev(), not before.
--- drivers/net/b44.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/b44.c +2 -2
@@ -2170,8 +2170,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev, dev->irq = sdev->irq;SET_ETHTOOL_OPS (dev, &b44_ethtool_ops); -netif_carrier_off (dev); - err =ssb_bus_powerup (sdev->bus,0 );if (err) { dev_err(sdev->dev,
@@ -2211,6 +2209,8 @@ static int __devinit b44_init_one(struct ssb_device *sdev, goto err_out_powerdown; } +netif_carrier_off (dev); +ssb_set_drvdata (sdev, dev);/* Chip reset provides power to the b44 MAC & PCI cores, which
Signature · 1 line
1.7.3.3
PATCH 212/260 ACPI: delete ZEPTO idle=nomwait DMI quirk
In reply to Paul GortmakerFrom: Len Brown <[email protected]>
commit 64a32307b710c100beb101e9c78f8022f0e8ba61 upstream.
per comments in the bug report, this entry
seems to hurt at much as it helps.
https://bugzilla.kernel.org/show_bug.cgi?id=10807
--- drivers/acpi/processor_core.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/acpi/processor_core.c +0 -6
@@ -29,12 +29,6 @@ static int set_no_mwait(const struct dmi_system_id *id)static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { { - set_no_mwait,"IFL91 board" , { -DMI_MATCH (DMI_BIOS_VENDOR ,"COMPAL" ), -DMI_MATCH (DMI_SYS_VENDOR ,"ZEPTO" ), -DMI_MATCH (DMI_PRODUCT_VERSION ,"3215W" ), -DMI_MATCH (DMI_BOARD_NAME ,"IFL91" ) },NULL }, - { set_no_mwait,"Extensa 5220" , {DMI_MATCH (DMI_BIOS_VENDOR ,"Phoenix Technologies LTD" ),DMI_MATCH (DMI_SYS_VENDOR ,"Acer" ),
Signature · 1 line
1.7.3.3
PATCH 207/260 powerpc: Don't use kernel stack with translation off
In reply to Paul GortmakerFrom: Michael Neuling <[email protected]>
commit 54a834043314c257210db2a9d59f8cc605571639 upstream.
In f761622e59433130bc33ad086ce219feee9eb961 we changed early_setup_secondary so it's called using the proper kernel stack rather than the emergency one.
Unfortunately, this stack pointer can't be used when translation is off on PHYP as this stack pointer might be outside the RMO. This results in the following on all non zero cpus:
cpu 0x1: Vector: 300 (Data Access) at [c00000001639fd10]
pc: 000000000001c50c
lr: 000000000000821c
sp: c00000001639ff90
msr: 8000000000001000
dar: c00000001639ffa0
dsisr: 42000000
current = 0xc000000016393540
paca = 0xc000000006e00200
pid = 0, comm = swapperThe original patch was only tested on bare metal system, so it never caught this problem.
This changes __secondary_start so that we calculate the new stack pointer but only start using it after we've called early_setup_secondary.
With this patch, the above problem goes away.
--- arch/powerpc/kernel/head_64.S | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
arch/powerpc/kernel/head_64.S +9 -3
@@ -575,13 +575,19 @@ __secondary_start: /* Initialize the kernel stack. Just a repeat for iSeries. */ LOAD_REG_ADDR(r3, current_set) sldi r28,r24,3 /* get current_set[cpu#] */ - ldx r1,r3,r28 - addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD - std r1,PACAKSAVE(r13) + ldx r14,r3,r28 + addi r14,r14,THREAD_SIZE-STACK_FRAME_OVERHEAD + std r14,PACAKSAVE(r13) /* Do early setup for that CPU (stab, slb, hash table pointer) */ bl .early_setup_secondary + /* + * setup the new stack pointer, but *don't* use this until + * translation is on. + */ + mr r1, r14 + /* Clear backchain so we get nice backtraces */ li r7,0 mtlr r7
Signature · 1 line
1.7.3.3
PATCH 190/260 De-pessimize rds_page_copy_user
In reply to Paul GortmakerFrom: Linus Torvalds <[email protected]>
commit 799c10559d60f159ab2232203f222f18fa3c4a5f upstream.
Don't try to "optimize" rds_page_copy_user() by using kmap_atomic() and the unsafe atomic user mode accessor functions. It's actually slower than the straightforward code on any reasonable modern CPU.
Back when the code was written (although probably not by the time it was actually merged, though), 32-bit x86 may have been the dominant architecture. And there kmap_atomic() can be a lot faster than kmap() (unless you have very good locality, in which case the virtual address caching by kmap() can overcome all the downsides).
But these days, x86-64 may not be more populous, but it's getting there (and if you care about performance, it's definitely already there - you'd have upgraded your CPU's already in the last few years). And on x86-64, the non-kmap_atomic() version is faster, simply because the code is simpler and doesn't have the "re-try page fault" case.
People with old hardware are not likely to care about RDS anyway, and the optimization for the 32-bit case is simply buggy, since it doesn't verify the user addresses properly.
--- net/rds/page.c | 27 +++++++-------------------- 1 files changed, 7 insertions(+), 20 deletions(-)
net/rds/page.c +7 -20
@@ -57,30 +57,17 @@ int rds_page_copy_user(struct page *page, unsigned long offset,unsigned long ret;void *addr; -if (to_user) + addr =kmap (page); +if (to_user) {rds_stats_add (s_copy_to_user, bytes); -else + ret =copy_to_user (ptr, addr + offset, bytes); + }else {rds_stats_add (s_copy_from_user, bytes); - - addr =kmap_atomic (page,KM_USER0 ); -if (to_user) - ret =__copy_to_user_inatomic (ptr, addr + offset, bytes); -else - ret =__copy_from_user_inatomic (addr + offset, ptr, bytes); -kunmap_atomic (addr,KM_USER0 ); - -if (ret) { - addr =kmap (page); -if (to_user) - ret =copy_to_user (ptr, addr + offset, bytes); -else - ret =copy_from_user (addr + offset, ptr, bytes); -kunmap (page); -if (ret) -return -EFAULT ; + ret =copy_from_user (addr + offset, ptr, bytes); } +kunmap (page); -return 0 ; +return ret ? -EFAULT :0 ; }EXPORT_SYMBOL_GPL (rds_page_copy_user);
Signature · 1 line
1.7.3.3
PATCH 219/260 staging: usbip: Notify usb core of port status changes
In reply to Paul GortmakerFrom: Max Vozeler <[email protected]>
commit 0c9a32f0192e656daa2ff3c9149f6d71b4a1b873 upstream.
This patch changes vhci to behave like dummy and other hcds when disconnecting a device.
Previously detaching a device from the root hub did not notify the usb core of the disconnect and left the device visible.
--- drivers/staging/usbip/vhci_hcd.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/usbip/vhci_hcd.c +2 -0
@@ -164,6 +164,8 @@ void rh_port_disconnect(int rhport)* spin_unlock(&vdev->ud.lock); */ spin_unlock_irqrestore (&the_controller->lock, flags); + +usb_hcd_poll_rh_status (vhci_to_hcd (the_controller)); }
Signature · 1 line
1.7.3.3
PATCH 224/260 bluetooth: Fix missing NULL check
In reply to Paul GortmakerFrom: Alan Cox <[email protected]>
commit c19483cc5e56ac5e22dd19cf25ba210ab1537773 upstream.
Fortunately this is only exploitable on very unusual hardware.
[Reported a while ago but nothing happened so just fixing it]
--- drivers/bluetooth/hci_ldisc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/bluetooth/hci_ldisc.c +7 -0
@@ -258,9 +258,16 @@ static int hci_uart_tty_open(struct tty_struct *tty)BT_DBG ("tty %p" , tty); +/* FIXME: This btw is bogus, nothing requires the old ldisc to clear +the pointer */ if (hu)return -EEXIST ; +/* Error if the tty has no write op instead of leaving an exploitable +hole */ +if (tty->ops->write ==NULL ) +return -EOPNOTSUPP ; +if (!(hu =kzalloc (sizeof (struct hci_uart ),GFP_KERNEL ))) {BT_ERR ("Can't allocate control structure" );return -ENFILE ;
Signature · 1 line
1.7.3.3
PATCH 184/260 hrtimer: Preserve timer state in remove_hrtimer()
In reply to Paul GortmakerFrom: Salman Qazi <[email protected]>
commit f13d4f979c518119bba5439dd2364d76d31dcd3f upstream.
The race is described as follows:
CPU X CPU Yremove_hrtimer
// state & QUEUED == 0timer->state = CALLBACK
unlock timer basetimer->f(n) //very long
hrtimer_start
lock timer base remove_hrtimer // no effect hrtimer_enqueue timer->state = CALLBACK |
QUEUED
unlock timer base
hrtimer_start
lock timer base remove_hrtimer
mode = INACTIVE // CALLBACK bit lost!
switch_hrtimer_base
CALLBACK bit not set:
timer->base changes to a different CPU.
lock this CPU's timer base
The bug was introduced with commit ca109491f (hrtimer: removing all ur callback modes) in 2.6.29
[ tglx: Feed new state via local variable and add a comment. ]
LKML-Reference: <[email protected]>
--- kernel/hrtimer.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
kernel/hrtimer.c +11 -2
@@ -936,6 +936,7 @@ static inline int remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base) { if (hrtimer_is_queued(timer)) { + unsigned long state;int reprogram;/*
@@ -949,8 +950,13 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base)debug_deactivate (timer);timer_stats_hrtimer_clear_start_info (timer); reprogram = base->cpu_base == &__get_cpu_var (hrtimer_bases); -__remove_hrtimer (timer, base,HRTIMER_STATE_INACTIVE , - reprogram); +/* +* We must preserve the CALLBACK state flag here, +* otherwise we could move the timer base in +* switch_hrtimer_base. +*/ + state = timer->state &HRTIMER_STATE_CALLBACK ; +__remove_hrtimer (timer, base, state, reprogram);return 1 ; }return 0 ;
@@ -1237,6 +1243,9 @@ static void __run_hrtimer(struct hrtimer *timer, ktime_t *now)BUG_ON (timer->state !=HRTIMER_STATE_CALLBACK );enqueue_hrtimer (timer, base); } + +WARN_ON_ONCE (!(timer->state &HRTIMER_STATE_CALLBACK )); + timer->state &= ~HRTIMER_STATE_CALLBACK ; }
Signature · 1 line
1.7.3.3
PATCH 230/260 x86, mtrr: Assume SYS_CFG[Tom2ForceMemTypeWB] exists on all future AMD CPUs
In reply to Paul GortmakerFrom: Andreas Herrmann <[email protected]>
commit 3fdbf004c1706480a7c7fac3c9d836fa6df20d7d upstream.
Instead of adapting the CPU family check in amd_special_default_mtrr() for each new CPU family assume that all new AMD CPUs support the necessary bits in SYS_CFG MSR.
Tom2Enabled is architectural (defined in APM Vol.2). Tom2ForceMemTypeWB is defined in all BKDGs starting with K8 NPT. In pre K8-NPT BKDG this bit is reserved (read as zero).
W/o this adaption Linux would unnecessarily complain about bad MTRR settings on every new AMD CPU family, e.g.
[ 0.000000] WARNING: BIOS bug: CPU MTRRs don't cover all of memory, losing 4863MB of RAM.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/mtrr/cleanup.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/mtrr/cleanup.c +1 -1
@@ -827,7 +827,7 @@ int __init amd_special_default_mtrr(void)if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD )return 0 ; -if (boot_cpu_data.x86 <0xf || boot_cpu_data.x86 >0x11 ) +if (boot_cpu_data.x86 <0xf )return 0 ;/* In case some hypervisor doesn't pass SYSCFG through: */ if (rdmsr_safe (MSR_K8_SYSCFG , &l, &h) <0 )
Signature · 1 line
1.7.3.3
PATCH 231/260 x86, intr-remap: Set redirection hint in the IRTE
In reply to Paul GortmakerFrom: Suresh Siddha <[email protected]>
commit 75e3cfbed6f71a8f151dc6e413b6ce3c390030cb upstream.
Currently the redirection hint in the interrupt-remapping table entry is set to 0, which means the remapped interrupt is directed to the processors listed in the destination. So in logical flat mode
in the presence of intr-remapping, this results in a single interrupt multi-casted to multiple cpu's as specified by the destination bit mask. But what we really want is to send that interrupt to one of the cpus based on the lowest priority delivery mode.
Set the redirection hint in the IRTE to '1' to indicate that we want the remapped interrupt to be directed to only one of the processors listed in the destination.
This fixes the issue of same interrupt getting delivered to multiple cpu's in the logical flat mode in the presence of interrupt-remapping. While there is no functional issue observed with this behavior, this will impact performance of such configurations (<=8 cpu's using logical flat mode in the presence of interrupt-remapping)
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/io_apic.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kernel/apic/io_apic.c +2 -0
@@ -1401,6 +1401,7 @@ int setup_ioapic_entry(int apic_id, int irq, irte.dlvry_mode = apic->irq_delivery_mode; irte.vector = vector; irte.dest_id =IRTE_DEST (destination); + irte.redir_hint =1 ;/* Set source-id of interrupt request */ set_ioapic_sid (&irte, apic_id);
@@ -3364,6 +3365,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, irte.dlvry_mode = apic->irq_delivery_mode; irte.vector = cfg->vector; irte.dest_id =IRTE_DEST (dest); + irte.redir_hint =1 ;/* Set source-id of interrupt request */ if (pdev)
Signature · 1 line
1.7.3.3
PATCH 226/260 mm, x86: Saving vmcore with non-lazy freeing of vmas
In reply to Paul GortmakerFrom: Cliff Wickman <[email protected]>
commit 3ee48b6af49cf534ca2f481ecc484b156a41451d upstream.
During the reading of /proc/vmcore the kernel is doing ioremap()/iounmap() repeatedly. And the buildup of un-flushed vm_area_struct's is causing a great deal of overhead. (rb_next() is chewing up most of that time).
This solution is to provide function set_iounmap_nonlazy(). It causes a subsequent call to iounmap() to immediately purge the vma area (with try_purge_vmap_area_lazy()).
With this patch we have seen the time for writing a 250MB compressed dump drop from 71 seconds to 44 seconds.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/io.h | 1 + arch/x86/kernel/crash_dump_64.c | 1 + mm/vmalloc.c | 9 +++++++++ 3 files changed, 11 insertions(+), 0 deletions(-)
arch/x86/include/asm/io.h +1 -0
@@ -206,6 +206,7 @@ static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)extern void iounmap (volatile void __iomem *addr); +extern void set_iounmap_nonlazy (void );#ifdef __KERNEL__
arch/x86/kernel/crash_dump_64.c +1 -0
@@ -46,6 +46,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, }else memcpy (buf, vaddr + offset, csize); +set_iounmap_nonlazy ();iounmap (vaddr);return csize; }
mm/vmalloc.c +9 -0
@@ -513,6 +513,15 @@ static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);static void purge_fragmented_blocks_allcpus (void );/* +* called before a call to iounmap() if the caller wants vm_area_struct's +* immediately freed. +*/ +void set_iounmap_nonlazy (void ) +{ +atomic_set (&vmap_lazy_nr,lazy_max_pages ()+1 ); +} + +/* * Purges all lazily-freed vmap areas. * * If sync is 0 then don't purge if there is already a purge in progress.
Signature · 7 lines
1.7.3.3 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 232/260 x86, kdump: Change copy_oldmem_page() to use cached addressing
In reply to Paul GortmakerFrom: Cliff Wickman <[email protected]>
commit 37a2f9f30a360fb03522d15c85c78265ccd80287 upstream.
The copy of /proc/vmcore to a user buffer proceeds much faster if the kernel addresses memory as cached.
With this patch we have seen an increase in transfer rate from less than 15MB/s to 80-460MB/s, depending on size of the transfer. This makes a big difference in time needed to save a system dump.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/crash_dump_64.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/crash_dump_64.c +1 -1
@@ -34,7 +34,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,if (!csize)return 0 ; - vaddr =ioremap (pfn <<PAGE_SHIFT ,PAGE_SIZE ); + vaddr =ioremap_cache (pfn <<PAGE_SHIFT ,PAGE_SIZE );if (!vaddr)return -ENOMEM ;
Signature · 7 lines
1.7.3.3 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 229/260 x86, olpc: Don't retry EC commands forever
In reply to Paul GortmakerFrom: Paul Fox <[email protected]>
commit 286e5b97eb22baab9d9a41ca76c6b933a484252c upstream.
Avoids a potential infinite loop.
It was observed once, during an EC hacking/debugging session - not in regular operation.
--- arch/x86/kernel/olpc.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kernel/olpc.c +4 -1
@@ -117,6 +117,7 @@ int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,unsigned long flags;int ret = -EIO ;int i; +int restarts =0 ;spin_lock_irqsave (&ec_lock, flags);
@@ -173,7 +174,9 @@ restart:if (wait_on_obf (0x6c ,1 )) {printk (KERN_ERR "olpc-ec: timeout waiting for" " EC to provide data!\n" ); - goto restart; +if (restarts++ <10 ) + goto restart; + goto err; } outbuf[i] =inb (0x68 ); printk(KERN_DEBUG "olpc-ec: received 0x%x\n",
Signature · 1 line
1.7.3.3
PATCH 223/260 sched: Fix string comparison in /proc/sched_features
In reply to Paul GortmakerFrom: Mathieu Desnoyers <[email protected]>
commit 7740191cd909b75d75685fb08a5d1f54b8a9d28b upstream.
Fix incorrect handling of the following case:
INTERACTIVE
INTERACTIVE_SOMETHING_ELSE
The comparison only checks up to each element's length.
Changelog since v1:
- Embellish using some Rostedtisms.
[ mingo: ^^ == smaller and cleaner ]
LKML-Reference: <20100913214700.GB16118@Krystal>
--- kernel/sched.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
kernel/sched.c +3 -4
@@ -713,7 +713,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { char buf[64]; -char *cmp = buf; +char *cmp;int neg =0 ;int i;
@@ -724,6 +724,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf,return -EFAULT ; buf[cnt] =0 ; + cmp =strstrip (buf);if (strncmp (buf,"NO_" ,3 ) ==0 ) { neg =1 ;
@@ -731,9 +732,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf, }for (i =0 ; sched_feat_names[i]; i++) { -int len =strlen (sched_feat_names[i]); - -if (strncmp (cmp, sched_feat_names[i], len) ==0 ) { +if (strcmp (cmp, sched_feat_names[i]) ==0 ) {if (neg) sysctl_sched_features &= ~(1UL << i);else
Signature · 1 line
1.7.3.3
PATCH 221/260 powerpc/perf: Fix sampling enable for PPC970
In reply to Paul GortmakerFrom: Paul Mackerras <[email protected]>
commit 9f5f9ffe50e90ed73040d2100db8bfc341cee352 upstream.
The logic to distinguish marked instruction events from ordinary events on PPC970 and derivatives was flawed. The result is that instruction sampling didn't get enabled in the PMU for some marked instruction events, so they would never trigger. This fixes it by adding the appropriate break statements in the switch statement.
--- arch/powerpc/kernel/ppc970-pmu.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/powerpc/kernel/ppc970-pmu.c +2 -0
@@ -169,9 +169,11 @@ static int p970_marked_instr_event(u64 event)switch (unit) {case PM_VPU : mask =0x4c ;/* byte 0 bits 2,3,6 */ +break ;case PM_LSU0 :/* byte 2 bits 0,2,3,4,6; all of byte 1 */ mask =0x085dff00 ; +break ;case PM_LSU1L : mask =0x50 <<24 ;/* byte 3 bits 4,6 */ break ;
Signature · 1 line
1.7.3.3
PATCH 225/260 futex: Fix errors in nested key ref-counting
In reply to Paul GortmakerFrom: Darren Hart <[email protected]>
commit 7ada876a8703f23befbb20a7465a702ee39b1704 upstream.
futex_wait() is leaking key references due to futex_wait_setup() acquiring an additional reference via the queue_lock() routine. The nested key ref-counting has been masking bugs and complicating code analysis. queue_lock() is only called with a previously ref-counted key, so remove the additional ref-counting from the queue_(un)lock() functions.
Also futex_wait_requeue_pi() drops one key reference too many in unqueue_me_pi(). Remove the key reference handling from unqueue_me_pi(). This was paired with a queue_lock() in futex_lock_pi(), so the count remains unchanged.
Document remaining nested key ref-counting sites.
LKML-Reference: <[email protected]>
--- kernel/futex.c | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-)
kernel/futex.c +16 -15
@@ -1363,7 +1363,6 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) {struct futex_hash_bucket *hb; -get_futex_key_refs (&q->key); hb =hash_futex (&q->key); q->lock_ptr = &hb->lock;
@@ -1375,7 +1374,6 @@ static inline void queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb) { spin_unlock(&hb->lock); -drop_futex_key_refs (&q->key); }/**
@@ -1480,8 +1478,6 @@ static void unqueue_me_pi(struct futex_q *q) q->pi_state =NULL ;spin_unlock (q->lock_ptr); - -drop_futex_key_refs (&q->key); }/*
@@ -1812,7 +1808,10 @@ static int futex_wait(u32 __user *uaddr, int fshared, } retry: -/* Prepare to wait on uaddr. */ +/* +* Prepare to wait on uaddr. On success, holds hb lock and increments +* q.key refs. +*/ ret =futex_wait_setup (uaddr, val, fshared, &q, &hb);if (ret) goto out;
@@ -1822,24 +1821,23 @@ retry:/* If we were woken (and unqueued), we succeeded, whatever. */ ret =0 ; +/* unqueue_me() drops q.key ref */ if (!unqueue_me (&q)) - goto out_put_key; + goto out; ret = -ETIMEDOUT ;if (to && !to->task) - goto out_put_key; + goto out;/* * We expect signal_pending(current), but we might be the * victim of a spurious wakeup as well. */ -if (!signal_pending (current)) { -put_futex_key (fshared, &q.key); +if (!signal_pending (current)) goto retry; - } ret = -ERESTARTSYS ;if (!abs_time) - goto out_put_key; + goto out; restart = ¤t_thread_info ()->restart_block; restart->fn = futex_wait_restart;
@@ -1856,8 +1854,6 @@ retry: ret = -ERESTART_RESTARTBLOCK ; -out_put_key: -put_futex_key (fshared, &q.key); out:if (to) {hrtimer_cancel (&to->timer);
@@ -2236,7 +2232,10 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared, q.rt_waiter = &rt_waiter; q.requeue_pi_key = &key2; -/* Prepare to wait on uaddr. */ +/* +* Prepare to wait on uaddr. On success, increments q.key (key1) ref +* count. +*/ ret =futex_wait_setup (uaddr, val, fshared, &q, &hb);if (ret) goto out_key2;
@@ -2254,7 +2253,9 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared,* In order for us to be here, we know our q.key == key2, and since * we took the hb->lock above, we also know that futex_requeue() has * completed and we no longer have to concern ourselves with a wakeup -* race with the atomic proxy lock acquition by the requeue code. +* race with the atomic proxy lock acquisition by the requeue code. The +* futex_requeue dropped our key1 reference and incremented our key2 +* reference count. */ /* Check if the requeue code acquired the second futex for us. */
Signature · 1 line
1.7.3.3
PATCH 247/260 usb: musb: blackfin: call gpio_free() on error path in musb_platform_init()
In reply to Paul GortmakerFrom: Sergei Shtylyov <[email protected]>
commit 00be545e49d83485d49a598d3b7e090088934be8 upstream.
Blackfin's musb_platform_init() needs to call gpio_free() for error cleanup iff otg_get_transceiver() call returns NULL.
--- drivers/usb/musb/blackfin.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/musb/blackfin.c +3 -1
@@ -289,8 +289,10 @@ int __init musb_platform_init(struct musb *musb)usb_nop_xceiv_register (); musb->xceiv =otg_get_transceiver (); -if (!musb->xceiv) +if (!musb->xceiv) { +gpio_free (musb->config->gpio_vrsel);return -ENODEV ; + }if (ANOMALY_05000346 ) {bfin_write_USB_APHY_CALIB (ANOMALY_05000346_value);
Signature · 1 line
1.7.3.3
PATCH 245/260 USB: ftdi_sio: new VID/PIDs for various Papouch devices
In reply to Paul GortmakerFrom: Daniel Suchy <[email protected]>
commit 59c6ccd9f9aecfa59c99ceba6d4d34b180547a05 upstream.
This patch for FTDI USB serial driver ads new VID/PIDs used on various devices manufactured by Papouch (http://www.papouch.com). These devices have their own VID/PID, although they're using standard FTDI chip. In ftdi_sio.c, I also made small cleanup to have declarations for all Papouch devices together.
--- drivers/usb/serial/ftdi_sio.c | 30 +++++++++++++++++++++++++++++- drivers/usb/serial/ftdi_sio_ids.h | 27 ++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-)
drivers/usb/serial/ftdi_sio.c +29 -1
@@ -681,7 +681,6 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, - { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) },
@@ -722,8 +721,37 @@ static struct usb_device_id id_table_combined [] = { .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, + +/* Papouch devices based on FTDI chip */ + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_2_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_2_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_2_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485S_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485C_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_LEC_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB232_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_IRAMP_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK5_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO8x8_PID) }, { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x2_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO10x1_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO30x3_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO60x3_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x16_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO3x32_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK6_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_UPSUSB_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_MU_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SIMUKEY_PID) }, { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMUX_PID) }, + { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMSR_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) }, { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) },
drivers/usb/serial/ftdi_sio_ids.h +26 -1
@@ -1030,9 +1030,34 @@*/ #define PAPOUCH_VID 0x5050/* Vendor ID */ +#define PAPOUCH_SB485_PID 0x0100/* Papouch SB485 USB-485/422 Converter */ +#define PAPOUCH_AP485_PID 0x0101/* AP485 USB-RS485 Converter */ +#define PAPOUCH_SB422_PID 0x0102/* Papouch SB422 USB-RS422 Converter */ +#define PAPOUCH_SB485_2_PID 0x0103/* Papouch SB485 USB-485/422 Converter */ +#define PAPOUCH_AP485_2_PID 0x0104/* AP485 USB-RS485 Converter */ +#define PAPOUCH_SB422_2_PID 0x0105/* Papouch SB422 USB-RS422 Converter */ +#define PAPOUCH_SB485S_PID 0x0106/* Papouch SB485S USB-485/422 Converter */ +#define PAPOUCH_SB485C_PID 0x0107/* Papouch SB485C USB-485/422 Converter */ +#define PAPOUCH_LEC_PID 0x0300/* LEC USB Converter */ +#define PAPOUCH_SB232_PID 0x0301/* Papouch SB232 USB-RS232 Converter */ #define PAPOUCH_TMU_PID 0x0400/* TMU USB Thermometer */ -#define PAPOUCH_QUIDO4x4_PID 0x0900/* Quido 4/4 Module */ +#define PAPOUCH_IRAMP_PID 0x0500/* Papouch IRAmp Duplex */ +#define PAPOUCH_DRAK5_PID 0x0700/* Papouch DRAK5 */ +#define PAPOUCH_QUIDO8x8_PID 0x0800/* Papouch Quido 8/8 Module */ +#define PAPOUCH_QUIDO4x4_PID 0x0900/* Papouch Quido 4/4 Module */ +#define PAPOUCH_QUIDO2x2_PID 0x0a00/* Papouch Quido 2/2 Module */ +#define PAPOUCH_QUIDO10x1_PID 0x0b00/* Papouch Quido 10/1 Module */ +#define PAPOUCH_QUIDO30x3_PID 0x0c00/* Papouch Quido 30/3 Module */ +#define PAPOUCH_QUIDO60x3_PID 0x0d00/* Papouch Quido 60(100)/3 Module */ +#define PAPOUCH_QUIDO2x16_PID 0x0e00/* Papouch Quido 2/16 Module */ +#define PAPOUCH_QUIDO3x32_PID 0x0f00/* Papouch Quido 3/32 Module */ +#define PAPOUCH_DRAK6_PID 0x1000/* Papouch DRAK6 */ +#define PAPOUCH_UPSUSB_PID 0x8000/* Papouch UPS-USB adapter */ +#define PAPOUCH_MU_PID 0x8001/* MU controller */ +#define PAPOUCH_SIMUKEY_PID 0x8002/* Papouch SimuKey */ #define PAPOUCH_AD4USB_PID 0x8003/* AD4USB Measurement Module */ +#define PAPOUCH_GMUX_PID 0x8004/* Papouch GOLIATH MUX */ +#define PAPOUCH_GMSR_PID 0x8005/* Papouch GOLIATH MSR */ /* * Marvell SheevaPlug
Signature · 1 line
1.7.3.3
PATCH 257/260 gdth: integer overflow in ioctl
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
commit f63ae56e4e97fb12053590e41a4fa59e7daa74a4 upstream.
gdth_ioctl_alloc() takes the size variable as an int. copy_from_user() takes the size variable as an unsigned long. gen.data_len and gen.sense_len are unsigned longs. On x86_64 longs are 64 bit and ints are 32 bit.
We could pass in a very large number and the allocation would truncate the size to 32 bits and allocate a small buffer. Then when we do the copy_from_user(), it would result in a memory corruption.
--- drivers/scsi/gdth.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/scsi/gdth.c +8 -0
@@ -4175,6 +4175,14 @@ static int ioc_general(void __user *arg, char *cmnd) ha =gdth_find_ha (gen.ionode);if (!ha)return -EFAULT ; + +if (gen.data_len >INT_MAX ) +return -EINVAL ; +if (gen.sense_len >INT_MAX ) +return -EINVAL ; +if (gen.data_len + gen.sense_len >INT_MAX ) +return -EINVAL ; +if (gen.data_len + gen.sense_len !=0 ) {if (!(buf =gdth_ioctl_alloc (ha, gen.data_len + gen.sense_len, FALSE, &paddr)))
Signature · 1 line
1.7.3.3
PATCH 251/260 USB: atmel_usba_udc: force vbus_pin at -EINVAL when gpio_request failled
In reply to Paul GortmakerFrom: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
commit 969affff54702785330de553b790372e261e93f9 upstream.
to ensure gpio_is_valid return false
--- drivers/usb/gadget/atmel_usba_udc.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/usb/gadget/atmel_usba_udc.c +3 -0
@@ -2015,6 +2015,9 @@ static int __init usba_udc_probe(struct platform_device *pdev) }else {disable_irq (gpio_to_irq (udc->vbus_pin)); } + }else { +/* gpio_request fail so use -EINVAL for gpio_is_valid */ + ubc->vbus_pin = -EINVAL ; } }
Signature · 1 line
1.7.3.3
PATCH 254/260 USB: accept some invalid ep0-maxpacket values
In reply to Paul GortmakerFrom: Alan Stern <[email protected]>
commit 56626a72a47bf3e50875d960d6b5f17b9bee0ab2 upstream.
A few devices (such as the RCA VR5220 voice recorder) are so non-compliant with the USB spec that they have invalid maxpacket sizes for endpoint 0. Nevertheless, as long as we can safely use them, we may as well do so.
This patch (as1432) softens our acceptance criterion by allowing high-speed devices to have ep0-maxpacket sizes other than 64. A warning is printed in the system log when this happens, and the existing error message is clarified.
--- drivers/usb/core/hub.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/usb/core/hub.c +6 -3
@@ -2848,13 +2848,16 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,else i = udev->descriptor.bMaxPacketSize0;if (le16_to_cpu (udev->ep0.desc.wMaxPacketSize) != i) { -if (udev->speed !=USB_SPEED_FULL || +if (udev->speed ==USB_SPEED_LOW || !(i ==8 || i ==16 || i ==32 || i ==64 )) { -dev_err (&udev->dev,"ep0 maxpacket = %d\n" , i); +dev_err (&udev->dev,"Invalid ep0 maxpacket: %d\n" , i); retval = -EMSGSIZE ; goto fail; } -dev_dbg (&udev->dev,"ep0 maxpacket = %d\n" , i); +if (udev->speed ==USB_SPEED_FULL ) +dev_dbg (&udev->dev,"ep0 maxpacket = %d\n" , i); +else +dev_warn (&udev->dev,"Using ep0 maxpacket: %d\n" , i); udev->ep0.desc.wMaxPacketSize =cpu_to_le16 (i);usb_ep0_reinit (udev); }
Signature · 1 line
1.7.3.3
PATCH 256/260 libsas: fix NCQ mixing with non-NCQ
In reply to Paul GortmakerFrom: David Milburn <[email protected]>
commit f0ad30d3d2dc924decc0e10b1ff6dc32525a5d99 upstream.
Some cards (like mvsas) have issue troubles if non-NCQ commands are mixed with NCQ ones. Fix this by using the libata default NCQ check routine which waits until all NCQ commands are complete before issuing a non-NCQ one. The impact to cards (like aic94xx) which don't need this logic should be minimal
--- drivers/scsi/libsas/sas_ata.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/scsi/libsas/sas_ata.c +1 -0
@@ -347,6 +347,7 @@ static int sas_ata_scr_read(struct ata_link *link, unsigned int sc_reg_in,static struct ata_port_operations sas_sata_ops = { .phy_reset = sas_ata_phy_reset, .post_internal_cmd = sas_ata_post_internal, + .qc_defer = ata_std_qc_defer, .qc_prep = ata_noop_qc_prep, .qc_issue = sas_ata_qc_issue, .qc_fill_rtf = sas_ata_qc_fill_rtf,
Signature · 1 line
1.7.3.3
PATCH 242/260 drivers/net/wireless/p54/eeprom.c: Return -ENOMEM on memory allocation failure
In reply to Paul GortmakerFrom: Julia Lawall <[email protected]>
commit 0d91f22b75347d9503b17a42b6c74d3f7750acd6 upstream.
In this code, 0 is returned on memory allocation failure, even though other failures return -ENOMEM or other similar values.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression ret;
expression x,e1,e2,e3;
@@
ret = 0
... when != ret = e1
*x = \(kmalloc\|kcalloc\|kzalloc\)(...)
... when != ret = e2
if (x == NULL) { ... when != ret = e3
return ret;
}
// </smpl>
--- drivers/net/wireless/p54/eeprom.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/wireless/p54/eeprom.c +3 -1
@@ -262,8 +262,10 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) list->max_entries = max_channel_num; list->channels =kzalloc (sizeof (struct p54_channel_entry ) * max_channel_num,GFP_KERNEL ); -if (!list->channels) +if (!list->channels) { + ret = -ENOMEM ; goto free; + }for (i =0 ; i < max_channel_num; i++) {if (i < priv->iq_autocal_len) {
Signature · 1 line
1.7.3.3
PATCH 260/260 sgi-xp: incoming XPC channel messages can come in after the channel's partition structures have been torn down
In reply to Paul GortmakerFrom: Robin Holt <[email protected]>
commit 09358972bff5ce99de496bbba97c85d417b3c054 upstream.
Under some workloads, some channel messages have been observed being delayed on the sending side past the point where the receiving side has been able to tear down its partition structures.
This condition is already detected in xpc_handle_activate_IRQ_uv(), but that information is not given to xpc_handle_activate_mq_msg_uv(). As a result, xpc_handle_activate_mq_msg_uv() assumes the structures still exist and references them, causing a NULL-pointer deref.
--- drivers/misc/sgi-xp/xpc_uv.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/misc/sgi-xp/xpc_uv.c +17 -0
@@ -417,6 +417,7 @@ xpc_process_activate_IRQ_rcvd_uv(void)static void xpc_handle_activate_mq_msg_uv (struct xpc_partition *part,struct xpc_activate_mq_msghdr_uv *msg_hdr, +int part_setup,int *wakeup_hb_checker) {unsigned long irq_flags;
@@ -481,6 +482,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV : {struct xpc_activate_mq_msg_chctl_closerequest_uv *msg; +if (!part_setup) +break ; + msg = container_of(msg_hdr, struct xpc_activate_mq_msg_chctl_closerequest_uv, hdr);
@@ -497,6 +501,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV : {struct xpc_activate_mq_msg_chctl_closereply_uv *msg; +if (!part_setup) +break ; + msg = container_of(msg_hdr, struct xpc_activate_mq_msg_chctl_closereply_uv, hdr);
@@ -511,6 +518,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV : {struct xpc_activate_mq_msg_chctl_openrequest_uv *msg; +if (!part_setup) +break ; + msg = container_of(msg_hdr, struct xpc_activate_mq_msg_chctl_openrequest_uv, hdr);
@@ -528,6 +538,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV : {struct xpc_activate_mq_msg_chctl_openreply_uv *msg; +if (!part_setup) +break ; + msg = container_of(msg_hdr, struct xpc_activate_mq_msg_chctl_openreply_uv, hdr); args = &part->remote_openclose_args[msg->ch_number];
@@ -545,6 +558,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV : {struct xpc_activate_mq_msg_chctl_opencomplete_uv *msg; +if (!part_setup) +break ; + msg = container_of(msg_hdr, struct xpc_activate_mq_msg_chctl_opencomplete_uv, hdr);spin_lock_irqsave (&part->chctl_lock, irq_flags);
@@ -621,6 +637,7 @@ xpc_handle_activate_IRQ_uv(int irq, void *dev_id) part_referenced =xpc_part_ref (part);xpc_handle_activate_mq_msg_uv (part, msg_hdr, + part_referenced, &wakeup_hb_checker);if (part_referenced)xpc_part_deref (part);
Signature · 1 line
1.7.3.3
PATCH 259/260 Fix regressions in scsi_internal_device_block
In reply to Paul GortmakerFrom: Mike Christie <[email protected]>
commit 986fe6c7f50974e871b8ab5a800f5310ea25b361 upstream.
Deleting a SCSI device on a blocked fc_remote_port (before fast_io_fail_tmo fires) results in a hanging thread:
STACK:
0 schedule+1108 [0x5cac48]
1 schedule_timeout+528 [0x5cb7fc]
2 wait_for_common+266 [0x5ca6be]
3 blk_execute_rq+160 [0x354054]
4 scsi_execute+324 [0x3b7ef4]
5 scsi_execute_req+162 [0x3b80ca]
6 sd_sync_cache+138 [0x3cf662]
7 sd_shutdown+138 [0x3cf91a]
8 sd_remove+112 [0x3cfe4c]
9 __device_release_driver+124 [0x3a08b8]
10 device_release_driver+60 [0x3a0a5c]
11 bus_remove_device+266 [0x39fa76]
12 device_del+340 [0x39d818]
13 __scsi_remove_device+204 [0x3bcc48]
14 scsi_remove_device+66 [0x3bcc8e]
15 sysfs_schedule_callback_work+50 [0x260d66]
16 worker_thread+622 [0x162326]
17 kthread+160 [0x1680b0]
18 kernel_thread_starter+6 [0x10aaea]
During the delete, the SCSI device is in moved to SDEV_CANCEL. When the FC transport class later calls scsi_target_unblock, this has no effect, since scsi_internal_device_unblock ignores SCSI devics in this state.
It looks like all these are regressions caused by:5c10e63c943b4c67561ddc6bf61e01d4141f881f
[SCSI] limit state transitions in scsi_internal_device_unblock
Fix by rejecting offline and cancel in the state transition.
--- drivers/scsi/scsi_lib.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/scsi/scsi_lib.c +2 -1
@@ -2436,7 +2436,8 @@ scsi_internal_device_unblock(struct scsi_device *sdev) sdev->sdev_state =SDEV_RUNNING ; else if (sdev->sdev_state == SDEV_CREATED_BLOCK) sdev->sdev_state = SDEV_CREATED; - else + else if (sdev->sdev_state != SDEV_CANCEL && + sdev->sdev_state != SDEV_OFFLINE) return -EINVAL;spin_lock_irqsave (q->queue_lock, flags);
Signature · 1 line
1.7.3.3
PATCH 183/260 dmaengine: fix interrupt clearing for mv_xor
In reply to Paul GortmakerFrom: Simon Guinot <[email protected]>
commit cc60f8878eab892c03d06b10f389232b9b66bd83 upstream.
When using simultaneously the two DMA channels on a same engine, some transfers are never completed. For example, an endless lock can occur while writing heavily on a RAID5 array (with async-tx offload support enabled).
Note that this issue can also be reproduced by using the DMA test client.
On a same engine, the interrupt cause register is shared between two DMA channels. This patch make sure that the cause bit is only cleared for the requested channel.
--- drivers/dma/mv_xor.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/mv_xor.c +1 -1
@@ -162,7 +162,7 @@ static int mv_is_err_intr(u32 intr_cause)static void mv_xor_device_clear_eoc_cause (struct mv_xor_chan *chan) { -u32 val = (1 << (1 + (chan->idx *16 ))); +u32 val = ~(1 << (chan->idx *16 ));dev_dbg (chan->device->common.dev,"%s, val 0x%08x\n" , __func__, val);__raw_writel (val,XOR_INTR_CAUSE (chan)); }
Signature · 1 line
1.7.3.3
PATCH 211/260 ACPI: EC: add Vista incompatibility DMI entry for Toshiba Satellite L355
In reply to Paul GortmakerFrom: Len Brown <[email protected]>
commit 7a1d602f5fc35d14907b7da98d5627acb69589d1 upstream.
https://bugzilla.kernel.org/show_bug.cgi?id=12641
--- drivers/acpi/blacklist.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/acpi/blacklist.c +8 -0
@@ -218,6 +218,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { }, }, { + .callback = dmi_disable_osi_vista, + .ident = "Toshiba Satellite L355", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"TOSHIBA" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "Satellite L355"), + }, + }, + { .callback = dmi_disable_osi_win7, .ident = "ASUS K50IJ", .matches = {
Signature · 1 line
1.7.3.3
PATCH 213/260 ACPI: Disable Windows Vista compatibility for Toshiba P305D
In reply to Paul GortmakerFrom: Zhang Rui <[email protected]>
commit 337279ce3aa85d81d34c0f837d1c204df105103b upstream.
Disable the Windows Vista (SP1) compatibility for Toshiba P305D.
http://bugzilla.kernel.org/show_bug.cgi?id=14736
--- drivers/acpi/blacklist.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/acpi/blacklist.c +8 -0
@@ -233,6 +233,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"), }, }, + { + .callback = dmi_disable_osi_vista, + .ident = "Toshiba P305D", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P305D"), + }, + },/* * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
Signature · 1 line
1.7.3.3
PATCH 210/260 intel_idle: PCI quirk to prevent Lenovo Ideapad s10-3 boot hang
In reply to Paul GortmakerFrom: Len Brown <[email protected]>
commit 4731fdcf6f7bdab3e369a3f844d4ea4d4017284d upstream.
When the Lenovo Ideapad S10-3 is booted with HT enabled, it hits a boot hang in the intel_idle driver.
This occurs when entering ATM-C4 for the first time, unless BM_STS is first cleared.
acpi_idle doesn't see this because it first checks and clears BM_STS, but it would hit the same hang if that check were disabled.
http://bugs.meego.com/show_bug.cgi?id=7093
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/634702
--- drivers/pci/quirks.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
drivers/pci/quirks.c +20 -0
@@ -150,6 +150,26 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_dDECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_NEC ,PCI_DEVICE_ID_NEC_CBUS_3 , quirk_isa_dma_hangs);/* +* Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear +* for some HT machines to use C4 w/o hanging. +*/ +static void __devinit quirk_tigerpoint_bm_sts (struct pci_dev *dev) +{ +u32 pmbase; +u16 pm1a; + +pci_read_config_dword (dev,0x40 , &pmbase); + pmbase = pmbase &0xff80 ; + pm1a =inw (pmbase); + +if (pm1a &0x10 ) { +dev_info (&dev->dev,FW_BUG "TigerPoint LPC.BM_STS cleared\n" ); +outw (0x10 , pmbase); + } +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_TGP_LPC , quirk_tigerpoint_bm_sts); + +/* * Chipsets where PCI->PCI transfers vanish or hang */ static void __devinit quirk_nopcipci (struct pci_dev *dev)
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 209/260 ACPI: enable repeated PCIEXP wakeup by clearing PCIEXP_WAKE_STS on resume
In reply to Paul GortmakerFrom: Colin Ian King <[email protected]>
commit 573b638158029898caf9470c8214b7ddd29751e3 upstream.
Section 4.7.3.1.1 (PM1 Status Registers) of version 4.0 of the ACPI spec concerning PCIEXP_WAKE_STS points out in in the final note field in table 4-11 that if this bit is set to 1 and the system is put into a sleeping state then the system will not automatically wake.
This bit gets set by hardware to indicate that the system woke up due to a PCI Express wakeup event, so clear it during acpi_hw_clear_acpi_status() calls to enable subsequent resumes to work.
--- drivers/acpi/acpica/aclocal.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/acpi/acpica/aclocal.h +1 -0
@@ -848,6 +848,7 @@ struct acpi_bit_register_info { ACPI_BITMASK_POWER_BUTTON_STATUS | \ ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ ACPI_BITMASK_RT_CLOCK_STATUS | \ + ACPI_BITMASK_PCIEXP_WAKE_DISABLE | \ ACPI_BITMASK_WAKE_STATUS)#define ACPI_BITMASK_TIMER_ENABLE 0x0001
Signature · 1 line
1.7.3.3
PATCH 258/260 Fix race when removing SCSI devices
In reply to Paul GortmakerFrom: Christof Schmitt <[email protected]>
commit 546ae796bfac6399e30da4b5af2cf7a6d0f8a4ec upstream.
Removing SCSI devices through
echo 1 > /sys/bus/scsi/devices/ ... /delete
while the FC transport class removes the SCSI target can lead to an oops:
Unable to handle kernel pointer dereference at virtual kernel address 00000000b6815000
Oops: 0011 [#1] PREEMPT SMP DEBUG_PAGEALLOC
Modules linked in: sunrpc qeth_l3 binfmt_misc dm_multipath scsi_dh dm_mod ipv6 qeth ccwgroup [last unloaded: scsi_wait_scan]
CPU: 1 Not tainted 2.6.35.5-45.x.20100924-s390xdefault #1
Process fc_wq_0 (pid: 861, task: 00000000b7331240, ksp: 00000000b735bac0)
Krnl PSW : 0704200180000000 00000000003ff6e4 (__scsi_remove_device+0x24/0xd0)
R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:2 PM:0 EA:3
Krnl GPRS: 0000000000000001 0000000000000000 00000000b6815000 00000000bc24a8c0
00000000003ff7c8 000000000056dbb8 0000000000000002 0000000000835d80
ffffffff00000000 0000000000001000 00000000b6815000 00000000bc24a7f0
00000000b68151a0 00000000b6815000 00000000b735bc20 00000000b735bbf8
Krnl Code: 00000000003ff6d6: a7840001 brc 8,3ff6d8
00000000003ff6da: a7fbffd8 aghi %r15,-40
00000000003ff6de: e3e0f0980024 stg %r14,152(%r15)
>00000000003ff6e4: e31021200004 lg %r1,288(%r2)
00000000003ff6ea: a71f0000 cghi %r1,0
00000000003ff6ee: a7a40011 brc 10,3ff710
00000000003ff6f2: a7390003 lghi %r3,3
00000000003ff6f6: c0e5ffffc8b1 brasl %r14,3f8858
Call Trace:
([<0000000000001000>] 0x1000)
[<00000000003ff7d2>] scsi_remove_device+0x42/0x54
[<00000000003ff8ba>] __scsi_remove_target+0xca/0xfc
[<00000000003ff99a>] __remove_child+0x3a/0x48
[<00000000003e3246>] device_for_each_child+0x72/0xbc
[<00000000003ff93a>] scsi_remove_target+0x4e/0x74
[<0000000000406586>] fc_rport_final_delete+0xb2/0x23c
[<000000000015d080>] worker_thread+0x200/0x344
[<000000000016330c>] kthread+0xa0/0xa8
[<0000000000106c1a>] kernel_thread_starter+0x6/0xc
[<0000000000106c14>] kernel_thread_starter+0x0/0xcINFO: lockdep is turned off.
Last Breaking-Event-Address:
[<00000000003ff7cc>] scsi_remove_device+0x3c/0x54
The function __scsi_remove_target iterates through the SCSI devices on the host, but it drops the host_lock before calling scsi_remove_device. When the SCSI device is deleted from another thread, the pointer to the SCSI device in scsi_remove_device can become invalid. Fix this by getting a reference to the SCSI device before dropping the host_lock to keep the SCSI device alive for the call to scsi_remove_device.
--- drivers/scsi/scsi_sysfs.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/scsi/scsi_sysfs.c +2 -1
@@ -993,10 +993,11 @@ static void __scsi_remove_target(struct scsi_target *starget)list_for_each_entry (sdev, &shost->__devices, siblings) {if (sdev->channel != starget->channel || sdev->id != starget->id || - sdev->sdev_state ==SDEV_DEL ) +scsi_device_get (sdev))continue ;spin_unlock_irqrestore (shost->host_lock, flags);scsi_remove_device (sdev); +scsi_device_put (sdev);spin_lock_irqsave (shost->host_lock, flags); goto restart; }
Signature · 1 line
1.7.3.3
PATCH 253/260 USB: opticon: Fix long-standing bugs in opticon driver
In reply to Paul GortmakerFrom: Alon Ziv <[email protected]>
commit 97cd8dc4ca9a1a5efb2cc38758e01492e3b013e2 upstream.
The bulk-read callback had two bugs:
a) The bulk-in packet's leading two zeros were returned (and the two last bytes truncated)
b) The wrong URB was transmitted for the second (and later) read requests, causing further reads to return the entire packet (including leading zeros)
--- drivers/usb/serial/opticon.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/serial/opticon.c +3 -3
@@ -96,8 +96,8 @@ static void opticon_bulk_callback(struct urb *urb)/* real data, send it to the tty layer */ tty =tty_port_tty_get (&port->port);if (tty) { -tty_insert_flip_string (tty, data, - data_length); +tty_insert_flip_string (tty, data +2 , + data_length);tty_flip_buffer_push (tty);tty_kref_put (tty); }
@@ -130,7 +130,7 @@ exit: priv->bulk_address), priv->bulk_in_buffer, priv->buffer_size, opticon_bulk_callback, priv); - result =usb_submit_urb (port->read_urb,GFP_ATOMIC ); + result =usb_submit_urb (priv->bulk_read_urb,GFP_ATOMIC );if (result) dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n",
Signature · 1 line
1.7.3.3
PATCH 248/260 USB: option: Add more ZTE modem USB id's
In reply to Paul GortmakerFrom: Mauro Carvalho Chehab <[email protected]>
commit ecfa153ef616b901e86d9a051b329fcda7a6ce7b upstream.
There are lots of ZTE USB id's currently not covered by usb/serial. Adds them, to allow those devices to work properly on Linux.
While here, put the USB ID's for 0x2002/0x2003 at the sorted order.
This patch is based on zte.c file found on MF645.
PS.: The ZTE driver is commenting the USB ID for 0x0053. It also adds, commented, an USB ID for 0x0026.
Not sure why, but I think that 0053 is used by their devices in storage mode only. So, I opted to keep the comment on this patch.
--- drivers/usb/serial/option.c | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-)
drivers/usb/serial/option.c +20 -3
@@ -616,6 +616,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff) },
@@ -627,38 +628,52 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, +/* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, */ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0034, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0038, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0040, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0044, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0050, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff) }, +/* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0053, 0xff, 0xff, 0xff) }, */ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0056, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0065, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0067, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0077, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0079, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0082, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) },
@@ -874,6 +889,8 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
Signature · 1 line
1.7.3.3
PATCH 255/260 sd name space exhaustion causes system hang
In reply to Paul GortmakerFrom: Michael Reed <[email protected]>
commit 1a03ae0f556a931aa3747b70e44b78308f5b0590 upstream.
Following a site power outage which re-enabled all the ports on my FC switches, my system subsequently booted with far too many luns! I had let it run hoping it would make multi-user. It didn't. :( It hung solid after exhausting the last sd device, sdzzz, and attempting to create sdaaaa and beyond. I was unable to get a dump.
Discovered using a 2.6.32.13 based system.
correct this by detecting when the last index is utilized and failing the sd probe of the device. Patch applies to scsi-misc-2.6.
--- drivers/scsi/sd.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
drivers/scsi/sd.c +10 -5
@@ -2163,11 +2163,10 @@ static void sd_probe_async(void *data, async_cookie_t cookie) index = sdkp->index; dev = &sdp->sdev_gendev; -if (index <SD_MAX_DISKS ) { - gd->major =sd_major ((index &0xf0 ) >>4 ); - gd->first_minor = ((index &0xf ) <<4 ) | (index &0xfff00 ); - gd->minors =SD_MINORS ; - } + gd->major =sd_major ((index &0xf0 ) >>4 ); + gd->first_minor = ((index &0xf ) <<4 ) | (index &0xfff00 ); + gd->minors =SD_MINORS ; + gd->fops = &sd_fops; gd->private_data = &sdkp->driver; gd->queue = sdkp->device->request_queue;
@@ -2256,6 +2255,12 @@ static int sd_probe(struct device *dev)if (error) goto out_put; +if (index >=SD_MAX_DISKS ) { + error = -ENODEV ; +sdev_printk (KERN_WARNING , sdp,"SCSI disk (sd) name space exhausted.\n" ); + goto out_free_index; + } + error =sd_format_disk_name ("sd" , index, gd->disk_name,DISK_NAME_LEN );if (error) goto out_free_index;
Signature · 1 line
1.7.3.3
PATCH 252/260 USB: disable endpoints after unbinding interfaces, not before
In reply to Paul GortmakerFrom: Alan Stern <[email protected]>
commit 80f0cf3947889014d3a3dc0ad60fb87cfda4b12a upstream.
This patch (as1430) fixes a bug in usbcore. When a device configuration change occurs or a device is removed, the endpoints for the old config should be completely disabled. However it turns out they aren't; this is because usb_unbind_interface() calls usb_enable_interface() or usb_set_interface() to put interfaces back in altsetting 0, which re-enables the interfaces' endpoints.
As a result, when a device goes through a config change or is unconfigured, the ep_in[] and ep_out[] arrays may be left holding old pointers to usb_host_endpoint structures. If the device is deauthorized these structures get freed, and the stale pointers cause errors when the the device is eventually unplugged.
The solution is to disable the endpoints after unbinding the interfaces instead of before. This isn't as large a change as it sounds, since usb_unbind_interface() disables all the interface's endpoints anyway before calling the driver's disconnect routine, unless the driver claims to support "soft" unbind.
This fixes Bugzilla #19192. Thanks to "Tom" Lei Ming for diagnosing the underlying cause of the problem.
--- drivers/usb/core/message.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/usb/core/message.c +7 -7
@@ -1155,13 +1155,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) {int i; -dev_dbg (&dev->dev,"%s nuking %s URBs\n" , __func__, - skip_ep0 ?"non-ep0" :"all" ); -for (i = skip_ep0; i <16 ; ++i) { -usb_disable_endpoint (dev, i, true); -usb_disable_endpoint (dev, i +USB_DIR_IN , true); - } -/* getting rid of interfaces will disconnect * any drivers bound to them (a key side effect) */
@@ -1191,6 +1184,13 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)if (dev->state ==USB_STATE_CONFIGURED )usb_set_device_state (dev,USB_STATE_ADDRESS ); } + +dev_dbg (&dev->dev,"%s nuking %s URBs\n" , __func__, + skip_ep0 ?"non-ep0" :"all" ); +for (i = skip_ep0; i <16 ; ++i) { +usb_disable_endpoint (dev, i, true); +usb_disable_endpoint (dev, i +USB_DIR_IN , true); + } }/**
Signature · 1 line
1.7.3.3
PATCH 250/260 USB: cp210x: Add WAGO 750-923 Service Cable device ID
In reply to Paul GortmakerFrom: Anders Larsen <[email protected]>
commit 93ad03d60b5b18897030038234aa2ebae8234748 upstream.
The WAGO 750-923 USB Service Cable is used for configuration and firmware updates of several industrial automation products from WAGO Kontakttechnik GmbH.
Bus 004 Device 002: ID 1be3:07a6
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x1be3 idProduct 0x07a6 bcdDevice 1.00 iManufacturer 1 Silicon Labs iProduct 2 WAGO USB Service Cable iSerial 3 1277796751
. . .
--- drivers/usb/serial/cp210x.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/serial/cp210x.c +1 -0
@@ -134,6 +134,7 @@ static const struct usb_device_id id_table[] = { { 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(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ { } /* Terminating Entry */ };
Signature · 1 line
1.7.3.3
PATCH 241/260 p54usb: add five more USBIDs
In reply to Paul GortmakerFrom: Christian Lamparter <[email protected]>
commit 1a92795dac419128eb511dce30a6aad672064b88 upstream.
Source:
http://www.wikidevi.com/wiki/Intersil/p54/usb/windows
--- drivers/net/wireless/p54/p54usb.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/net/wireless/p54/p54usb.c +13 -0
@@ -33,8 +33,17 @@ MODULE_ALIAS("prism54usb");MODULE_FIRMWARE ("isl3886usb" );MODULE_FIRMWARE ("isl3887usb" ); +/* +* Note: +* +* Always update our wiki's device list (located at: +* http://wireless.kernel.org/en/users/Drivers/p54/devices ), +* whenever you add a new device. +*/ +static struct usb_device_id p54u_table[]__devinitdata = {/* Version 1 devices (pci chip + net2280) */ + {USB_DEVICE (0x045e ,0x00c2 )},/* Microsoft MN-710 */ {USB_DEVICE (0x0506 ,0x0a11 )},/* 3COM 3CRWE254G72 */ {USB_DEVICE (0x06b9 ,0x0120 )},/* Thomson SpeedTouch 120g */ {USB_DEVICE (0x0707 ,0xee06 )},/* SMC 2862W-G */
@@ -47,7 +56,9 @@ static struct usb_device_id p54u_table[] __devinitdata = { {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ + {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ + {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */ {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */ {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */
@@ -60,6 +71,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ + {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */
@@ -79,6 +91,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ + {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */
Signature · 1 line
1.7.3.3
PATCH 244/260 USB: add PID for FTDI based OpenDCC hardware
In reply to Paul GortmakerFrom: Rainer Keller <[email protected]>
commit 99c1e4f89d1033444ce4d0c064bd2826e81c3775 upstream.
The OpenDCC project is developing a new hardware. This patch adds its PID to the list of known FTDI devices. The PID can be found at
http://www.opendcc.de/elektronik/usb/opendcc_usb.html
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -182,6 +182,7 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) }, { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) }, { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
drivers/usb/serial/ftdi_sio_ids.h +1 -0
@@ -61,6 +61,7 @@#define FTDI_OPENDCC_SNIFFER_PID 0xBFD9#define FTDI_OPENDCC_THROTTLE_PID 0xBFDA#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB +#define FTDI_OPENDCC_GBM_PID 0xBFDC/* * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com)
Signature · 1 line
1.7.3.3
PATCH 217/260 execve: make responsive to SIGKILL with large arguments
In reply to Paul GortmakerFrom: Roland McGrath <[email protected]>
commit 9aea5a65aa7a1af9a4236dfaeb0088f1624f9919 upstream.
An execve with a very large total of argument/environment strings can take a really long time in the execve system call. It runs uninterruptibly to count and copy all the strings. This change makes it abort the exec quickly if sent a SIGKILL.
Note that this is the conservative change, to interrupt only for SIGKILL, by using fatal_signal_pending(). It would be perfectly correct semantics to let any signal interrupt the string-copying in execve, i.e. use signal_pending() instead of fatal_signal_pending(). We'll save that change for later, since it could have user-visible consequences, such as having a timer set too quickly make it so that an execve can never complete, though it always happened to work before.
--- fs/exec.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
fs/exec.c +7 -0
@@ -376,6 +376,9 @@ static int count(char __user * __user * argv, int max) argv++;if (i++ >= max)return -E2BIG ; + +if (fatal_signal_pending (current)) +return -ERESTARTNOHAND ;cond_resched (); } }
@@ -419,6 +422,10 @@ static int copy_strings(int argc, char __user * __user * argv,while (len >0 ) {int offset, bytes_to_copy; +if (fatal_signal_pending (current)) { + ret = -ERESTARTNOHAND ; + goto out; + }cond_resched (); offset = pos %PAGE_SIZE ;
Signature · 1 line
1.7.3.3
PATCH 249/260 USB: cp210x: Add Renesas RX-Stick device ID
In reply to Paul GortmakerFrom: DJ Delorie <[email protected]>
commit 2f1136d1d08a63dcdbcd462621373f30d8dfe590 upstream.
RX610 development board by Renesas
Bus 001 Device 024: ID 045b:0053 Hitachi, Ltd
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x045b Hitachi, Ltd idProduct 0x0053 bcdDevice 1.00 iManufacturer 1 Silicon Labs iProduct 2 RX-Stick iSerial 3 0001
. . .
http://am.renesas.com/rx610stick
--- drivers/usb/serial/cp210x.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/serial/cp210x.c +1 -0
@@ -56,6 +56,7 @@ static int cp210x_carrier_raised(struct usb_serial_port *p);static int debug;static const struct usb_device_id id_table[] = { + {USB_DEVICE (0x045B ,0x0053 ) },/* Renesas RX610 RX-Stick */ {USB_DEVICE (0x0471 ,0x066A ) },/* AKTAKOM ACE-1001 cable */ {USB_DEVICE (0x0489 ,0xE000 ) },/* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ {USB_DEVICE (0x0745 ,0x1000 ) },/* CipherLab USB CCD Barcode Scanner 1000 */
Signature · 1 line
1.7.3.3
PATCH 246/260 USB: ftdi_sio: add device ids for ScienceScope
In reply to Paul GortmakerFrom: Greg Kroah-Hartman <[email protected]>
commit 0f266abd70cd83571eca019f764b5f1992da7361 upstream.
This adds the requested device ids to the ftdi_sio driver.
--- drivers/usb/serial/ftdi_sio.c | 3 +++ drivers/usb/serial/ftdi_sio_ids.h | 5 +++++ 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/usb/serial/ftdi_sio.c +3 -0
@@ -797,6 +797,9 @@ static struct usb_device_id id_table_combined [] = { { 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) }, + { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, { }, /* Optional parameter entry */ { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +5 -0
@@ -1102,3 +1102,8 @@* Accesio USB Data Acquisition products (http://www.accesio.com/) */ #define ACCESIO_COM4SM_PID 0xD578 + +/* www.sciencescope.co.uk educational dataloggers */ +#define FTDI_SCIENCESCOPE_LOGBOOKML_PID 0xFF18 +#define FTDI_SCIENCESCOPE_LS_LOGBOOK_PID 0xFF1C +#define FTDI_SCIENCESCOPE_HS_LOGBOOK_PID 0xFF1D
Signature · 1 line
1.7.3.3
PATCH 240/260 p54usb: fix off-by-one on !CONFIG_PM
In reply to Paul GortmakerFrom: Christian Lamparter <[email protected]>
commit 11791a6f7534906b4a01ffb54ba0b02ca39398ef upstream.
The ISL3887 chip needs a USB reset, whenever the usb-frontend module "p54usb" is reloaded.
This patch fixes an off-by-one bug, if the user
is running a kernel without the CONFIG_PM option set and for some reason (e.g.: compat-wireless) wants to switch between different p54usb modules.
--- drivers/net/wireless/p54/p54usb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/p54/p54usb.c +1 -1
@@ -931,8 +931,8 @@ static int __devinit p54u_probe(struct usb_interface *intf,#ifdef CONFIG_PM /* ISL3887 needs a full reset on resume */ udev->reset_resume =1 ; +#endif /* CONFIG_PM */ err =p54u_device_reset (dev); -#endif priv->hw_type =P54U_3887 ; dev->extra_tx_headroom +=sizeof (struct lm87_tx_hdr );
Signature · 1 line
1.7.3.3
PATCH 243/260 USB: ftdi_sio: Add PID for accesio products
In reply to Paul GortmakerFrom: Rich Mattes <[email protected]>
commit 3126d8236ca6f68eb8292c6af22c2e59afbeef24 upstream.
Adds support for Accesio USB to Serial adapters, which are built around FTDI FT232 UARTs. Tested with the Accesio USB-COM-4SM.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 7 insertions(+), 0 deletions(-)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -757,6 +757,7 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) }, + { USB_DEVICE(FTDI_VID, ACCESIO_COM4SM_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) },
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -1070,3 +1070,9 @@* Submitted by John G. Rogers */ #define SEGWAY_RMP200_PID 0xe729 + + +/* +* Accesio USB Data Acquisition products (http://www.accesio.com/) +*/ +#define ACCESIO_COM4SM_PID 0xD578
Signature · 1 line
1.7.3.3
PATCH 218/260 mm: Move vma_stack_continue into mm.h
In reply to Paul GortmakerFrom: Stefan Bader <[email protected]>
commit 39aa3cb3e8250db9188a6f1e3fb62ffa1a717678 upstream.
So it can be used by all that need to check for that.
--- fs/proc/task_mmu.c | 3 ++- include/linux/mm.h | 6 ++++++ mm/mlock.c | 6 ------ 3 files changed, 8 insertions(+), 7 deletions(-)
fs/proc/task_mmu.c +2 -1
@@ -224,7 +224,8 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)/* We don't show the stack guard page in /proc/maps */ start = vma->vm_start;if (vma->vm_flags &VM_GROWSDOWN ) - start +=PAGE_SIZE ; +if (!vma_stack_continue (vma->vm_prev, vma->vm_start)) + start +=PAGE_SIZE ; seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n", start,
include/linux/mm.h +6 -0
@@ -859,6 +859,12 @@ int set_page_dirty(struct page *page);int set_page_dirty_lock (struct page *page);int clear_page_dirty_for_io (struct page *page); +/* Is the vma a continuation of the stack vma above it? */ +static inline int vma_stack_continue (struct vm_area_struct *vma,unsigned long addr) +{ +return vma && (vma->vm_end == addr) && (vma->vm_flags &VM_GROWSDOWN ); +} +extern unsigned long move_page_tables (struct vm_area_struct *vma,unsigned long old_addr,struct vm_area_struct *new_vma,unsigned long new_addr,unsigned long len);
mm/mlock.c +0 -6
@@ -135,12 +135,6 @@ void munlock_vma_page(struct page *page) } } -/* Is the vma a continuation of the stack vma above it? */ -static inline int vma_stack_continue (struct vm_area_struct *vma,unsigned long addr) -{ -return vma && (vma->vm_end == addr) && (vma->vm_flags &VM_GROWSDOWN ); -} -static inline int stack_guard_page (struct vm_area_struct *vma,unsigned long addr) { return (vma->vm_flags & VM_GROWSDOWN) &&
Signature · 1 line
1.7.3.3
PATCH 215/260 setup_arg_pages: diagnose excessive argument size
In reply to Paul GortmakerFrom: Roland McGrath <[email protected]>
commit 1b528181b2ffa14721fb28ad1bd539fe1732c583 upstream.
The CONFIG_STACK_GROWSDOWN variant of setup_arg_pages() does not check the size of the argument/environment area on the stack. When it is unworkably large, shift_arg_pages() hits its BUG_ON. This is exploitable with a very large RLIMIT_STACK limit, to create a crash pretty easily.
Check that the initial stack is not too large to make it possible to map in any executable. We're not checking that the actual executable (or intepreter, for binfmt_elf) will fit. So those mappings might clobber part of the initial stack mapping. But that is just userland lossage that userland made happen, not a kernel problem.
--- fs/exec.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
fs/exec.c +5 -0
@@ -593,6 +593,11 @@ int setup_arg_pages(struct linux_binprm *bprm,#else stack_top =arch_align_stack (stack_top); stack_top =PAGE_ALIGN (stack_top); + +if (unlikely (stack_top < mmap_min_addr) || +unlikely (vma->vm_end - vma->vm_start >= stack_top - mmap_min_addr)) +return -ENOMEM ; + stack_shift = vma->vm_end - stack_top; bprm->p -= stack_shift;
Signature · 1 line
1.7.3.3
PATCH 233/260 KVM: MMU: fix direct sp's access corrupted
In reply to Paul GortmakerFrom: Xiao Guangrong <[email protected]>
commit 9e7b0e7fba45ca3c6357aeb7091ebc281f1de365 upstream.
If the mapping is writable but the dirty flag is not set, we will find the read-only direct sp and setup the mapping, then if the write #PF occur, we will mark this mapping writable in the read-only direct sp, now, other real read-only mapping will happily write it without #PF.
It may hurt guest's COW
Fixed by re-install the mapping when write #PF occur.
--- arch/x86/kvm/paging_tmpl.h | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-)
arch/x86/kvm/paging_tmpl.h +26 -2
@@ -318,8 +318,32 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,break ; } -if (is_shadow_present_pte (*sptep) && !is_large_pte (*sptep)) -continue ; +if (is_shadow_present_pte (*sptep) && !is_large_pte (*sptep)) { +struct kvm_mmu_page *child; +unsigned direct_access; + +if (level != gw->level) +continue ; + +/* +* For the direct sp, if the guest pte's dirty bit +* changed form clean to dirty, it will corrupt the +* sp's access: allow writable in the read-only sp, +* so we should update the spte at this point to get +* a new sp with the correct access. +*/ + direct_access = gw->pt_access & gw->pte_access; +if (!is_dirty_gpte (gw->ptes[gw->level -1 ])) + direct_access &= ~ACC_WRITE_MASK ; + + child =page_header (*sptep &PT64_BASE_ADDR_MASK ); +if (child->role.access == direct_access) +continue ; + +mmu_page_remove_parent_pte (child, sptep); +__set_spte (sptep, shadow_trap_nonpresent_pte); +kvm_flush_remote_tlbs (vcpu->kvm); + }if (is_large_pte (*sptep)) {rmap_remove (vcpu->kvm, sptep);
Signature · 1 line
1.7.3.3
PATCH 238/260 KVM: Fix fs/gs reload oops with invalid ldt
In reply to Paul GortmakerFrom: Avi Kivity <[email protected]>
commit 9581d442b9058d3699b4be568b6e5eae38a41493 upstream.
kvm reloads the host's fs and gs blindly, however the underlying segment descriptors may be invalid due to the user modifying the ldt after loading them.
Fix by using the safe accessors (loadsegment() and load_gs_index()) instead of home grown unsafe versions.
This is CVE-2010-3698.
KVM-Stable-Tag.
--- arch/x86/include/asm/kvm_host.h | 24 ------------------------ arch/x86/kvm/svm.c | 15 ++++++++++----- arch/x86/kvm/vmx.c | 24 +++++++++--------------- 3 files changed, 19 insertions(+), 44 deletions(-)
arch/x86/include/asm/kvm_host.h +0 -24
@@ -691,20 +691,6 @@ static inline struct kvm_mmu_page *page_header(hpa_t shadow_page)return (struct kvm_mmu_page *)page_private (page); } -static inline u16 kvm_read_fs (void ) -{ -u16 seg; - asm("mov %%fs, %0" :"=g" (seg)); -return seg; -} - -static inline u16 kvm_read_gs (void ) -{ -u16 seg; - asm("mov %%gs, %0" :"=g" (seg)); -return seg; -} -static inline u16 kvm_read_ldt (void ) {u16 ldt;
@@ -712,16 +698,6 @@ static inline u16 kvm_read_ldt(void)return ldt; } -static inline void kvm_load_fs (u16 sel) -{ - asm("mov %0, %%fs" : :"rm" (sel)); -} - -static inline void kvm_load_gs (u16 sel) -{ - asm("mov %0, %%gs" : :"rm" (sel)); -} -static inline void kvm_load_ldt (u16 sel) { asm("lldt %0" : :"rm" (sel));
arch/x86/kvm/svm.c +10 -5
@@ -2821,8 +2821,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)sync_lapic_to_cr8 (vcpu);save_host_msrs (vcpu); - fs_selector =kvm_read_fs (); - gs_selector =kvm_read_gs (); +savesegment (fs, fs_selector); +savesegment (gs, gs_selector); ldt_selector =kvm_read_ldt (); svm->vmcb->save.cr2 = vcpu->arch.cr2;/* required for live migration with NPT */
@@ -2909,10 +2909,15 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) vcpu->arch.regs[VCPU_REGS_RSP ] = svm->vmcb->save.rsp; vcpu->arch.regs[VCPU_REGS_RIP ] = svm->vmcb->save.rip; -kvm_load_fs (fs_selector); -kvm_load_gs (gs_selector); -kvm_load_ldt (ldt_selector);load_host_msrs (vcpu); +loadsegment (fs, fs_selector); +#ifdef CONFIG_X86_64 +load_gs_index (gs_selector); +wrmsrl (MSR_KERNEL_GS_BASE , current->thread.gs); +#else +loadsegment (gs, gs_selector); +#endif +kvm_load_ldt (ldt_selector);reload_tss (vcpu);
arch/x86/kvm/vmx.c +9 -15
@@ -651,7 +651,7 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)*/ vmx->host_state.ldt_sel =kvm_read_ldt (); vmx->host_state.gs_ldt_reload_needed = vmx->host_state.ldt_sel; - vmx->host_state.fs_sel =kvm_read_fs (); +savesegment (fs, vmx->host_state.fs_sel);if (!(vmx->host_state.fs_sel &7 )) {vmcs_write16 (HOST_FS_SELECTOR , vmx->host_state.fs_sel); vmx->host_state.fs_reload_needed =0 ;
@@ -659,7 +659,7 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)vmcs_write16 (HOST_FS_SELECTOR ,0 ); vmx->host_state.fs_reload_needed =1 ; } - vmx->host_state.gs_sel =kvm_read_gs (); +savesegment (gs, vmx->host_state.gs_sel);if (!(vmx->host_state.gs_sel &7 ))vmcs_write16 (HOST_GS_SELECTOR , vmx->host_state.gs_sel);else {
@@ -689,27 +689,21 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)static void __vmx_load_host_state (struct vcpu_vmx *vmx) { -unsigned long flags; -if (!vmx->host_state.loaded)return ; ++vmx->vcpu.stat.host_state_reload; vmx->host_state.loaded =0 ;if (vmx->host_state.fs_reload_needed) -kvm_load_fs (vmx->host_state.fs_sel); +loadsegment (fs, vmx->host_state.fs_sel);if (vmx->host_state.gs_ldt_reload_needed) {kvm_load_ldt (vmx->host_state.ldt_sel); -/* -* If we have to reload gs, we must take care to -* preserve our gs base. -*/ -local_irq_save (flags); -kvm_load_gs (vmx->host_state.gs_sel);#ifdef CONFIG_X86_64 -wrmsrl (MSR_GS_BASE ,vmcs_readl (HOST_GS_BASE )); +load_gs_index (vmx->host_state.gs_sel); +wrmsrl (MSR_KERNEL_GS_BASE , current->thread.gs); +#else +loadsegment (gs, vmx->host_state.gs_sel);#endif -local_irq_restore (flags); }reload_tss ();#ifdef CONFIG_X86_64
@@ -2414,8 +2408,8 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)vmcs_write16 (HOST_CS_SELECTOR , __KERNEL_CS);/* 22.2.4 */ vmcs_write16 (HOST_DS_SELECTOR , __KERNEL_DS);/* 22.2.4 */ vmcs_write16 (HOST_ES_SELECTOR , __KERNEL_DS);/* 22.2.4 */ -vmcs_write16 (HOST_FS_SELECTOR ,kvm_read_fs ());/* 22.2.4 */ -vmcs_write16 (HOST_GS_SELECTOR ,kvm_read_gs ());/* 22.2.4 */ +vmcs_write16 (HOST_FS_SELECTOR ,0 );/* 22.2.4 */ +vmcs_write16 (HOST_GS_SELECTOR ,0 );/* 22.2.4 */ vmcs_write16 (HOST_SS_SELECTOR , __KERNEL_DS);/* 22.2.4 */ #ifdef CONFIG_X86_64 rdmsrl (MSR_FS_BASE , a);
Signature · 1 line
1.7.3.3
PATCH 236/260 KVM: x86: Fix SVM VMCB reset
In reply to Paul GortmakerFrom: Zachary Amsden <[email protected]>
commit 58877679fd393d3ef71aa383031ac7817561463d upstream.
On reset, VMCB TSC should be set to zero. Instead, code was setting tsc_offset to zero, which passes through the underlying TSC.
--- arch/x86/kvm/svm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/svm.c +1 -1
@@ -632,7 +632,7 @@ static void init_vmcb(struct vcpu_svm *svm) control->iopm_base_pa = iopm_base; control->msrpm_base_pa =__pa (svm->msrpm); - control->tsc_offset =0 ; + control->tsc_offset =0 -native_read_tsc (); control->int_ctl =V_INTR_MASKING_MASK ;init_seg (&save->es);
Signature · 1 line
1.7.3.3
PATCH 237/260 KVM: x86: Move TSC reset out of vmcb_init
In reply to Paul GortmakerFrom: Zachary Amsden <[email protected]>
commit 47008cd887c1836bcadda123ba73e1863de7a6c4 upstream.
The VMCB is reset whenever we receive a startup IPI, so Linux is setting TSC back to zero happens very late in the boot process and destabilizing the TSC. Instead, just set TSC to zero once at VCPU creation time.
Why the separate patch? So git-bisect is your friend.
--- arch/x86/kvm/svm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/svm.c +1 -1
@@ -632,7 +632,6 @@ static void init_vmcb(struct vcpu_svm *svm) control->iopm_base_pa = iopm_base; control->msrpm_base_pa =__pa (svm->msrpm); - control->tsc_offset =0 -native_read_tsc (); control->int_ctl =V_INTR_MASKING_MASK ;init_seg (&save->es);
@@ -766,6 +765,7 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) svm->vmcb_pa =page_to_pfn (page) <<PAGE_SHIFT ; svm->asid_generation =0 ;init_vmcb (svm); + svm->vmcb->control.tsc_offset =0 -native_read_tsc ();fx_init (&svm->vcpu); svm->vcpu.arch.apic_base =0xfee00000 |MSR_IA32_APICBASE_ENABLE ;
Signature · 1 line
1.7.3.3
PATCH 216/260 execve: improve interactivity with large arguments
In reply to Paul GortmakerFrom: Roland McGrath <[email protected]>
commit 7993bc1f4663c0db67bb8f0d98e6678145b387cd upstream.
This adds a preemption point during the copying of the argument and environment strings for execve, in copy_strings(). There is already a preemption point in the count() loop, so this doesn't add any new points in the abstract sense.
When the total argument+environment strings are very large, the time spent copying them can be much more than a normal user time slice. So this change improves the interactivity of the rest of the system when one process is doing an execve with very large arguments.
--- fs/exec.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/exec.c +2 -0
@@ -419,6 +419,8 @@ static int copy_strings(int argc, char __user * __user * argv,while (len >0 ) {int offset, bytes_to_copy; +cond_resched (); + offset = pos %PAGE_SIZE ;if (offset ==0 ) offset =PAGE_SIZE ;
Signature · 1 line
1.7.3.3
PATCH 234/260 KVM: MMU: fix conflict access permissions in direct sp
In reply to Paul GortmakerFrom: Xiao Guangrong <[email protected]>
commit 5fd5387c89ec99ff6cb82d2477ffeb7211b781c2 upstream.
In no-direct mapping, we mark sp is 'direct' when we mapping the guest's larger page, but its access is encoded form upper page-struct entire not include the last mapping, it will cause access conflict.
For example, have this mapping:
[W]
/ PDE1 -> |---|
P[W] | | LPA
\ PDE2 -> |---|
[R]P have two children, PDE1 and PDE2, both PDE1 and PDE2 mapping the same lage page(LPA). The P's access is WR, PDE1's access is WR, PDE2's access is RO(just consider read-write permissions here)
When guest access PDE1, we will create a direct sp for LPA, the sp's access is from P, is W, then we will mark the ptes is W in this sp.
Then, guest access PDE2, we will find LPA's shadow page, is the same as PDE's, and mark the ptes is RO.
So, if guest access PDE1, the incorrect #PF is occured.
Fixed by encode the last mapping access into direct shadow page
--- arch/x86/kvm/paging_tmpl.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kvm/paging_tmpl.h +2 -0
@@ -356,6 +356,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, direct =1 ;if (!is_dirty_gpte (gw->ptes[level - delta])) access &= ~ACC_WRITE_MASK ; + access &= gw->pte_access; + table_gfn =gpte_to_gfn (gw->ptes[level - delta]);/* advance table_gfn when emulating 1gb pages with 4k */ if (delta ==0 )
Signature · 1 line
1.7.3.3
PATCH 239/260 pipe: fix failure to return error code on ->confirm()
In reply to Paul GortmakerFrom: Nicolas Kaiser <[email protected]>
commit e5953cbdff26f7cbae7eff30cd9b18c4e19b7594 upstream.
The arguments were transposed, we want to assign the error code to 'ret', which is being returned.
--- fs/pipe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/pipe.c +1 -1
@@ -363,7 +363,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, error = ops->confirm (pipe, buf);if (error) {if (!ret) - error = ret; + ret = error;break ; }
Signature · 1 line
1.7.3.3
PATCH 235/260 KVM: VMX: Fix host GDT.LIMIT corruption
In reply to Paul GortmakerFrom: Avi Kivity <[email protected]>
commit 3444d7da1839b851eefedd372978d8a982316c36 upstream.
vmx does not restore GDT.LIMIT to the host value, instead it sets it to 64KB. This means host userspace can learn a few bits of host memory.
Fix by reloading GDTR when we load other host state.
--- arch/x86/kvm/vmx.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/x86/kvm/vmx.c +4 -0
@@ -170,6 +170,7 @@ static u64 construct_eptp(unsigned long root_hpa); static DEFINE_PER_CPU(struct vmcs *, vmxarea); static DEFINE_PER_CPU(struct vmcs *, current_vmcs); static DEFINE_PER_CPU(struct list_head, vcpus_on_cpu); +static DEFINE_PER_CPU(struct desc_ptr, host_gdt);static unsigned long *vmx_io_bitmap_a;static unsigned long *vmx_io_bitmap_b;
@@ -717,6 +718,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx) wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); }#endif +load_gdt (&__get_cpu_var (host_gdt)); }static void vmx_load_host_state (struct vcpu_vmx *vmx)
@@ -1218,6 +1220,8 @@ static int hardware_enable(void *garbage)ept_sync_global (); +store_gdt (&__get_cpu_var (host_gdt)); +return 0 ; }
Signature · 1 line
1.7.3.3
PATCH 228/260 x86, kexec: Make sure to stop all CPUs before exiting the kernel
In reply to Paul GortmakerFrom: Alok Kataria <[email protected]>
commit 76fac077db6b34e2c6383a7b4f3f4f7b7d06d8ce upstream.
x86 smp_ops now has a new op, stop_other_cpus which takes a parameter "wait" this allows the caller to specify if it wants to stop until all the cpus have processed the stop IPI. This is required specifically for the kexec case where we should wait for all the cpus to be stopped before starting the new kernel. We now wait for the cpus to stop in all cases except for panic/kdump where we expect things to be broken and we are doing our best to make things work anyway.
This patch fixes a legitimate regression, which was introduced during 2.6.30, by commit id 4ef702c10b5df18ab04921fc252c26421d4d6c75.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/smp.h | 9 +++++++-- arch/x86/kernel/reboot.c | 2 +- arch/x86/kernel/smp.c | 15 +++++++++------ arch/x86/xen/enlighten.c | 2 +- arch/x86/xen/smp.c | 6 +++--- 5 files changed, 21 insertions(+), 13 deletions(-)
arch/x86/include/asm/smp.h +7 -2
@@ -50,7 +50,7 @@ struct smp_ops {void (*smp_prepare_cpus)(unsigned max_cpus);void (*smp_cpus_done)(unsigned max_cpus); -void (*smp_send_stop)(void ); +void (*stop_other_cpus)(int wait);void (*smp_send_reschedule)(int cpu);int (*cpu_up)(unsigned cpu);
@@ -73,7 +73,12 @@ extern struct smp_ops smp_ops;static inline void smp_send_stop (void ) { - smp_ops.smp_send_stop (); + smp_ops.stop_other_cpus (0 ); +} + +static inline void stop_other_cpus (void ) +{ + smp_ops.stop_other_cpus (1 ); }static inline void smp_prepare_boot_cpu (void )
arch/x86/kernel/reboot.c +1 -1
@@ -633,7 +633,7 @@ void native_machine_shutdown(void)/* O.K Now that I'm on the appropriate processor, * stop all of the others. */ -smp_send_stop (); +stop_other_cpus ();#endif lapic_shutdown ();
arch/x86/kernel/smp.c +9 -6
@@ -159,10 +159,10 @@ asmlinkage void smp_reboot_interrupt(void)irq_exit (); } -static void native_smp_send_stop (void ) +static void native_stop_other_cpus (int wait) {unsigned long flags; -unsigned long wait; +unsigned long timeout;if (reboot_force)return ;
@@ -179,9 +179,12 @@ static void native_smp_send_stop(void)if (num_online_cpus () >1 ) { apic->send_IPI_allbutself (REBOOT_VECTOR ); -/* Don't wait longer than a second */ - wait =USEC_PER_SEC ; -while (num_online_cpus () >1 && wait--) +/* +* Don't wait longer than a second if the caller +* didn't ask us to wait. +*/ + timeout =USEC_PER_SEC ; +while (num_online_cpus () >1 && (wait || timeout--))udelay (1 ); }
@@ -227,7 +230,7 @@ struct smp_ops smp_ops = { .smp_prepare_cpus = native_smp_prepare_cpus, .smp_cpus_done = native_smp_cpus_done, - .smp_send_stop = native_smp_send_stop, + .stop_other_cpus = native_stop_other_cpus, .smp_send_reschedule = native_smp_send_reschedule, .cpu_up = native_cpu_up,
arch/x86/xen/enlighten.c +1 -1
@@ -1001,7 +1001,7 @@ static void xen_reboot(int reason)struct sched_shutdown r = { .reason = reason };#ifdef CONFIG_SMP -smp_send_stop (); +stop_other_cpus ();#endif if (HYPERVISOR_sched_op (SCHEDOP_shutdown, &r))
arch/x86/xen/smp.c +3 -3
@@ -398,9 +398,9 @@ static void stop_self(void *v)BUG (); } -static void xen_smp_send_stop (void ) +static void xen_stop_other_cpus (int wait) { -smp_call_function (stop_self,NULL ,0 ); +smp_call_function (stop_self,NULL , wait); }static void xen_smp_send_reschedule (int cpu)
@@ -468,7 +468,7 @@ static const struct smp_ops xen_smp_ops __initdata = { .cpu_disable = xen_cpu_disable, .play_dead = xen_play_dead, - .smp_send_stop = xen_smp_send_stop, + .stop_other_cpus = xen_stop_other_cpus, .smp_send_reschedule = xen_smp_send_reschedule, .send_call_func_ipi = xen_smp_send_call_function_ipi,
Signature · 1 line
1.7.3.3
PATCH 227/260 x86, cpu: Fix renamed, not-yet-shipping AMD CPUID feature bit
In reply to Paul GortmakerFrom: Andre Przywara <[email protected]>
commit 7ef8aa72ab176e0288f363d1247079732c5d5792 upstream.
The AMD SSE5 feature set as-it has been replaced by some extensions to the AVX instruction set. Thus the bit formerly advertised as SSE5 is re-used for one of these extensions (XOP).
Although this changes the /proc/cpuinfo output, it is not user visible, as there are no CPUs (yet) having this feature.
To avoid confusion this should be added to the stable series, too.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/cpufeature.h | 2 +- arch/x86/kvm/x86.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/cpufeature.h +1 -1
@@ -150,7 +150,7 @@#define X86_FEATURE_3DNOWPREFETCH (6*32+ 8)/* 3DNow prefetch instructions */ #define X86_FEATURE_OSVW (6*32+ 9)/* OS Visible Workaround */ #define X86_FEATURE_IBS (6*32+10)/* Instruction Based Sampling */ -#define X86_FEATURE_SSE5 (6*32+11)/* SSE-5 */ +#define X86_FEATURE_XOP (6*32+11)/* extended AVX instructions */ #define X86_FEATURE_SKINIT (6*32+12)/* SKINIT/STGI instructions */ #define X86_FEATURE_WDT (6*32+13)/* Watchdog timer */ #define X86_FEATURE_NODEID_MSR (6*32+19)/* NodeId MSR */
arch/x86/kvm/x86.c +1 -1
@@ -1844,7 +1844,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,const u32 kvm_supported_word6_x86_features =F (LAHF_LM ) |F (CMP_LEGACY ) |F (SVM ) |0 /* ExtApicSpace */ |F (CR8_LEGACY ) |F (ABM ) |F (SSE4A ) |F (MISALIGNSSE ) | - F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(SSE5) | + F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(XOP) |0 /* SKINIT */ |0 /* WDT */ ;/* all calls to cpuid_count() should be made on the same cpu */
Signature · 1 line
1.7.3.3
PATCH 222/260 pcmcia: synclink_cs: fix information leak to userland
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
commit 5b917a1420d3d1a9c8da49fb0090692dc9aaee86 upstream.
Structure new_line is copied to userland with some padding fields unitialized. It leads to leaking of stack memory.
--- drivers/char/pcmcia/synclink_cs.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/char/pcmcia/synclink_cs.c +2 -0
@@ -4144,6 +4144,8 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)if (cmd !=SIOCWANDEV )return hdlc_ioctl (dev, ifr, cmd); +memset (&new_line,0 , size); +switch (ifr->ifr_settings.type) {case IF_GET_IFACE :/* return current sync_serial_settings */
Signature · 1 line
1.7.3.3
PATCH 220/260 staging: usbip: Process event flags without delay
In reply to Paul GortmakerFrom: Max Vozeler <[email protected]>
commit 584c5b7cf06194464240280483ee0376cdddbbae upstream.
The way the event handler works can cause it to delay events until eventual wakeup for another event.
For example, on device detach (vhci):
- Write to sysfs detach file
-> usbip_event_add(VDEV_EVENT_DOWN)
-> wakeup()#define VDEV_EVENT_DOWN (USBIP_EH_SHUTDOWN | USBIP_EH_RESET).
- Event thread wakes up and passes the event to event_handler() to process.
- It processes and clears the USBIP_EH_SHUTDOWN flag then returns.
- The outer event loop (event_handler_loop()) calls wait_event_interruptible().
The processing of the second flag which is part of VDEV_EVENT_DOWN (USBIP_EH_RESET) did not happen yet. It is delayed until the next event.
This means the ->reset callback may not happen for a long time (if ever), leaving the usbip port in a weird state which prevents its reuse.
This patch changes the handler to process all flags before waiting for another wakeup.
I have verified this change to fix a problem which prevented reattach of a usbip device. It also helps for socket errors which missed the RESET as well.
The delayed event processing also affects the stub side of usbip and the error handling there.
--- drivers/staging/usbip/usbip_event.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-)
drivers/staging/usbip/usbip_event.c +3 -13
@@ -38,21 +38,13 @@ static int event_handler(struct usbip_device *ud) ud->eh_ops.shutdown (ud); ud->event &= ~USBIP_EH_SHUTDOWN ; - -break ; } -/* Stop the error handler. */ -if (ud->event &USBIP_EH_BYE ) -return -1 ; -/* Reset the device. */ if (ud->event &USBIP_EH_RESET ) { ud->eh_ops.reset (ud); ud->event &= ~USBIP_EH_RESET ; - -break ; }/* Mark the device as unusable. */
@@ -60,13 +52,11 @@ static int event_handler(struct usbip_device *ud) ud->eh_ops.unusable (ud); ud->event &= ~USBIP_EH_UNUSABLE ; - -break ; } -/* NOTREACHED */ -printk (KERN_ERR "%s: unknown event\n" , __func__); -return -1 ; +/* Stop the error handler. */ +if (ud->event &USBIP_EH_BYE ) +return -1 ; }return 0 ;
Signature · 1 line
1.7.3.3
PATCH 205/260 bsg: fix incorrect device_status value
In reply to Paul GortmakerFrom: FUJITA Tomonori <[email protected]>
commit 478971600e47cb83ff2d3c63c5c24f2b04b0d6a1 upstream.
bsg incorrectly returns sg's masked_status value for device_status.
--- block/bsg.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
block/bsg.c +1 -1
@@ -426,7 +426,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,/* * fill in all the output members */ - hdr->device_status =status_byte (rq->errors); + hdr->device_status = rq->errors &0xff ; hdr->transport_status =host_byte (rq->errors); hdr->driver_status =driver_byte (rq->errors); hdr->info =0 ;
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 206/260 powerpc: Initialise paca->kstack before early_setup_secondary
In reply to Paul GortmakerFrom: Matt Evans <[email protected]>
commit f761622e59433130bc33ad086ce219feee9eb961 upstream.
As early setup calls down to slb_initialize(), we must have kstack initialised before checking "should we add a bolted SLB entry for our kstack?"
Failing to do so means stack access requires an SLB miss exception to refill an entry dynamically, if the stack isn't accessible via SLB(0) (kernel text & static data). It's not always allowable to take such a miss, and intermittent crashes will result.
Primary CPUs don't have this issue; an SLB entry is not bolted for their stack anyway (as that lives within SLB(0)). This patch therefore only affects the init of secondaries.
--- arch/powerpc/kernel/head_64.S | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/head_64.S +3 -3
@@ -572,9 +572,6 @@ __secondary_start: /* Set thread priority to MEDIUM */ HMT_MEDIUM - /* Do early setup for that CPU (stab, slb, hash table pointer) */ - bl .early_setup_secondary - /* Initialize the kernel stack. Just a repeat for iSeries. */ LOAD_REG_ADDR(r3, current_set) sldi r28,r24,3 /* get current_set[cpu#] */
@@ -582,6 +579,9 @@ __secondary_start: addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD std r1,PACAKSAVE(r13) + /* Do early setup for that CPU (stab, slb, hash table pointer) */ + bl .early_setup_secondary + /* Clear backchain so we get nice backtraces */ li r7,0 mtlr r7
Signature · 1 line
1.7.3.3
PATCH 214/260 x86: detect scattered cpuid features earlier
In reply to Paul GortmakerFrom: Jacob Pan <[email protected]>
commit 1dedefd1a066a795a87afca9c0236e1a94de9bf6 upstream.
Some extra CPU features such as ARAT is needed in early boot so that x86_init function pointers can be set up properly.
http://lkml.org/lkml/2010/5/18/519
At start_kernel() level, this patch moves init_scattered_cpuid_features() from check_bugs() to setup_arch() -> early_cpu_init() which is earlier than platform specific x86_init layer setup. Suggested by HPA.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/common.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/common.c +1 -1
@@ -576,6 +576,7 @@ void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)if (c->extended_cpuid_level >=0x80000007 ) c->x86_power =cpuid_edx (0x80000007 ); +init_scattered_cpuid_features (c); }static void __cpuinit identify_cpu_without_cpuid (struct cpuinfo_x86 *c)
@@ -731,7 +732,6 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)get_model_name (c);/* Default name */ -init_scattered_cpuid_features (c);detect_nopl (c); }
Signature · 1 line
1.7.3.3
PATCH 203/260 skge: add quirk to limit DMA
In reply to Paul GortmakerFrom: Stanislaw Gruszka <[email protected]>
commit 392bd0cb000d4aac9e88e4f50823db85e7220688 upstream.
Skge devices installed on some Gigabyte motherboards are not able to perform 64 dma correctly due to board PCI implementation, so limit DMA to 32bit if such boards are detected.
Bug was reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=447489
--- drivers/net/skge.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-)
drivers/net/skge.c +17 -1
@@ -43,6 +43,7 @@#include <linux/seq_file.h> #include <linux/mii.h> #include <linux/slab.h> +#include <linux/dmi.h> #include <asm/irq.h> #include "skge.h"
@@ -3868,6 +3869,8 @@ static void __devinit skge_show_addr(struct net_device *dev)netif_info (skge, probe, skge->netdev,"addr %pM\n" , dev->dev_addr); } +static int only_32bit_dma; +static int __devinit skge_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -3889,7 +3892,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,pci_set_master (pdev); -if (!pci_set_dma_mask (pdev,DMA_BIT_MASK (64 ))) { +if (!only_32bit_dma && !pci_set_dma_mask (pdev,DMA_BIT_MASK (64 ))) { using_dac =1 ; err =pci_set_consistent_dma_mask (pdev,DMA_BIT_MASK (64 )); }else if (!(err =pci_set_dma_mask (pdev,DMA_BIT_MASK (32 )))) {
@@ -4147,8 +4150,21 @@ static struct pci_driver skge_driver = { .shutdown = skge_shutdown, }; +static struct dmi_system_id skge_32bit_dma_boards[] = { + { + .ident ="Gigabyte nForce boards" , + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"Gigabyte Technology Co" ), +DMI_MATCH (DMI_BOARD_NAME ,"nForce" ), + }, + }, + {} +}; +static int __init skge_init_module (void ) { +if (dmi_check_system (skge_32bit_dma_boards)) + only_32bit_dma =1 ;skge_debug_init ();return pci_register_driver (&skge_driver); }
Signature · 1 line
1.7.3.3
PATCH 204/260 r8169: allocate with GFP_KERNEL flag when able to sleep
In reply to Paul GortmakerFrom: Stanislaw Gruszka <[email protected]>
commit aeb19f6052b5e5c8a24aa444fbff73b84341beac upstream.
We have fedora bug report where driver fail to initialize after suspend/resume because of memory allocation errors:
https://bugzilla.redhat.com/show_bug.cgi?id=629158
To fix use GFP_KERNEL allocation where possible.
--- drivers/net/r8169.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/r8169.c +6 -6
@@ -3970,7 +3970,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,static struct sk_buff *rtl8169_alloc_rx_skb (struct pci_dev *pdev,struct net_device *dev,struct RxDesc *desc,int rx_buf_sz, -unsigned int align) +unsigned int align,gfp_t gfp) {struct sk_buff *skb;dma_addr_t mapping;
@@ -3978,7 +3978,7 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, pad = align ? align :NET_IP_ALIGN ; - skb =netdev_alloc_skb (dev, rx_buf_sz + pad); + skb =__netdev_alloc_skb (dev, rx_buf_sz + pad, gfp);if (!skb) goto err_out;
@@ -4009,7 +4009,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp) }static u32 rtl8169_rx_fill (struct rtl8169_private *tp,struct net_device *dev, -u32 start,u32 end) +u32 start,u32 end,gfp_t gfp) {u32 cur;
@@ -4024,7 +4024,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, skb =rtl8169_alloc_rx_skb (tp->pci_dev, dev, tp->RxDescArray + i, - tp->rx_buf_sz, tp->align); + tp->rx_buf_sz, tp->align, gfp);if (!skb)break ;
@@ -4052,7 +4052,7 @@ static int rtl8169_init_ring(struct net_device *dev)memset (tp->tx_skb,0x0 ,NUM_TX_DESC *sizeof (struct ring_info ));memset (tp->Rx_skbuff,0x0 ,NUM_RX_DESC *sizeof (struct sk_buff *)); -if (rtl8169_rx_fill (tp, dev,0 ,NUM_RX_DESC ) !=NUM_RX_DESC ) +if (rtl8169_rx_fill (tp, dev,0 ,NUM_RX_DESC ,GFP_KERNEL ) !=NUM_RX_DESC ) goto err_out;rtl8169_mark_as_last_descriptor (tp->RxDescArray +NUM_RX_DESC -1 );
@@ -4553,7 +4553,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, count = cur_rx - tp->cur_rx; tp->cur_rx = cur_rx; - delta =rtl8169_rx_fill (tp, dev, tp->dirty_rx, tp->cur_rx); + delta =rtl8169_rx_fill (tp, dev, tp->dirty_rx, tp->cur_rx,GFP_ATOMIC );if (!delta && count)netif_info (tp, intr, dev,"no Rx buffer allocated\n" ); tp->dirty_rx += delta;
Signature · 1 line
1.7.3.3
PATCH 176/260 v4l1: fix 32-bit compat microcode loading translation
In reply to Paul GortmakerFrom: Linus Torvalds <[email protected]>
commit 3e645d6b485446c54c6745c5e2cf5c528fe4deec upstream.
The compat code for the VIDIOCSMICROCODE ioctl is totally buggered. It's only used by the VIDEO_STRADIS driver, and that one is scheduled to staging and eventually removed unless somebody steps up to maintain it (at which point it should use request_firmware() rather than some magic ioctl). So we'll get rid of it eventually.
But in the meantime, the compatibility ioctl code is broken, and this tries to get it to at least limp along (even if Mauro suggested just deleting it entirely, which may be the right thing to do - I don't think the compatibility translation code has ever worked unless you were very lucky).
--- drivers/media/video/v4l2-compat-ioctl32.c | 32 +++++++++++++++++++---------- 1 files changed, 21 insertions(+), 11 deletions(-)
drivers/media/video/v4l2-compat-ioctl32.c +21 -11
@@ -193,17 +193,24 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __ustruct video_code32 {char loadwhat[16 ];/* name or tag of file being passed */ compat_int_t datasize; -unsigned char *data; +compat_uptr_t data; }; -static int get_microcode32 (struct video_code *kp,struct video_code32 __user *up) +static struct video_code __user *get_microcode32 (struct video_code32 *kp) { -if (!access_ok (VERIFY_READ , up,sizeof (struct video_code32 )) || -copy_from_user (kp->loadwhat, up->loadwhat,sizeof (up->loadwhat)) || -get_user (kp->datasize, &up->datasize) || -copy_from_user (kp->data, up->data, up->datasize)) -return -EFAULT ; -return 0 ; +struct video_code __user *up; + + up =compat_alloc_user_space (sizeof (*up)); + +/* +* NOTE! We don't actually care if these fail. If the +* user address is invalid, the native ioctl will do +* the error handling for us +*/ + (void )copy_to_user (up->loadwhat, kp->loadwhat,sizeof (up->loadwhat)); + (void )put_user (kp->datasize, &up->datasize); + (void )put_user (compat_ptr (kp->data), &up->data); +return up; }#define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32)
@@ -744,7 +751,7 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arstruct video_tuner vt;struct video_buffer vb;struct video_window vw; -struct video_code vc; +struct video_code32 vc;struct video_audio va;#endif struct v4l2_format v2f;
@@ -823,8 +830,11 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arbreak ;case VIDIOCSMICROCODE : - err =get_microcode32 (&karg.vc, up); - compatible_arg =0 ; +/* Copy the 32-bit "video_code32" to kernel space */ +if (copy_from_user (&karg.vc, up,sizeof (karg.vc))) +return -EFAULT ; +/* Convert the 32-bit version to a 64-bit version in user space */ + up =get_microcode32 (&karg.vc);break ;case VIDIOCSFREQ :
Signature · 1 line
1.7.3.3
PATCH 202/260 net: blackhole route should always be recalculated
In reply to Paul GortmakerFrom: Jianzhao Wang <[email protected]>
commit ae2688d59b5f861dc70a091d003773975d2ae7fb upstream.
Blackhole routes are used when xfrm_lookup() returns -EREMOTE (error triggered by IKE for example), hence this kind of route is always temporary and so we should check if a better route exists for next packets.
Bug has been introduced by commit d11a4dc18bf41719c9f0d7ed494d295dd2973b92.
--- net/ipv4/route.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
net/ipv4/route.c +6 -1
@@ -2758,6 +2758,11 @@ slow_output:EXPORT_SYMBOL_GPL (__ip_route_output_key); +static struct dst_entry *ipv4_blackhole_dst_check (struct dst_entry *dst,u32 cookie) +{ +return NULL ; +} +static void ipv4_rt_blackhole_update_pmtu (struct dst_entry *dst,u32 mtu) { }
@@ -2766,7 +2771,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = { .family = AF_INET, .protocol = cpu_to_be16(ETH_P_IP), .destroy = ipv4_dst_destroy, - .check = ipv4_dst_check, + .check = ipv4_blackhole_dst_check, .update_pmtu = ipv4_rt_blackhole_update_pmtu, .entries = ATOMIC_INIT(0), };
Signature · 1 line
1.7.3.3
PATCH 197/260 ip: fix truesize mismatch in ip fragmentation
In reply to Paul GortmakerFrom: Eric Dumazet <[email protected]>
commit 3d13008e7345fa7a79d8f6438150dc15d6ba6e9d upstream.
Special care should be taken when slow path is hit in ip_fragment() :
When walking through frags, we transfert truesize ownership from skb to frags. Then if we hit a slow_path condition, we must undo this or risk uncharging frags->truesize twice, and in the end, having negative socket sk_wmem_alloc counter, or even freeing socket sooner than expected.
Many thanks to Nick Bowler, who provided a very clean bug report and test program.
Thanks to Jarek for reviewing my first patch and providing a V2
While Nick bisection pointed to commit 2b85a34e911 (net: No more expensive sock_hold()/sock_put() on each tx), underlying bug is older (2.6.12-rc5)
A side effect is to extend work done in commit b2722b1c3a893e (ip_fragment: also adjust skb->truesize for packets not owned by a socket) to ipv6 as well.
--- net/ipv4/ip_output.c | 19 +++++++++++++------ net/ipv6/ip6_output.c | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 11 deletions(-)
net/ipv4/ip_output.c +13 -6
@@ -479,9 +479,8 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))* we can switch to copy when see the first bad fragment. */ if (skb_has_frags (skb)) { -struct sk_buff *frag; +struct sk_buff *frag, *frag2;int first_len =skb_pagelen (skb); -int truesizes =0 ; if (first_len - hlen > mtu || ((first_len - hlen) & 7) ||
@@ -494,18 +493,18 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))if (frag->len > mtu || ((frag->len &7 ) && frag->next) ||skb_headroom (frag) < hlen) - goto slow_path; + goto slow_path_clean;/* Partially cloned skb? */ if (skb_shared (frag)) - goto slow_path; + goto slow_path_clean;BUG_ON (frag->sk);if (skb->sk) { frag->sk = skb->sk; frag->destructor = sock_wfree; } - truesizes += frag->truesize; + skb->truesize -= frag->truesize; }/* Everything is OK. Generate! */
@@ -515,7 +514,6 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) frag =skb_shinfo (skb)->frag_list;skb_frag_list_init (skb); skb->data_len = first_len -skb_headlen (skb); - skb->truesize -= truesizes; skb->len = first_len; iph->tot_len =htons (first_len); iph->frag_off =htons (IP_MF );
@@ -567,6 +565,15 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) }IP_INC_STATS (dev_net (dev),IPSTATS_MIB_FRAGFAILS );return err; + +slow_path_clean: + skb_walk_frags(skb, frag2) { +if (frag2 == frag) +break ; + frag2->sk =NULL ; + frag2->destructor =NULL ; + skb->truesize += frag2->truesize; + } } slow_path:
net/ipv6/ip6_output.c +13 -5
@@ -646,7 +646,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))if (skb_has_frags (skb)) {int first_len =skb_pagelen (skb); -int truesizes =0 ; +struct sk_buff *frag2; if (first_len - hlen > mtu || ((first_len - hlen) & 7) ||
@@ -658,18 +658,18 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))if (frag->len > mtu || ((frag->len &7 ) && frag->next) ||skb_headroom (frag) < hlen) - goto slow_path; + goto slow_path_clean;/* Partially cloned skb? */ if (skb_shared (frag)) - goto slow_path; + goto slow_path_clean;BUG_ON (frag->sk);if (skb->sk) { frag->sk = skb->sk; frag->destructor = sock_wfree; - truesizes += frag->truesize; } + skb->truesize -= frag->truesize; } err =0 ;
@@ -700,7 +700,6 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) first_len =skb_pagelen (skb); skb->data_len = first_len -skb_headlen (skb); - skb->truesize -= truesizes; skb->len = first_len;ipv6_hdr (skb)->payload_len =htons (first_len -sizeof (struct ipv6hdr ));
@@ -763,6 +762,15 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) IPSTATS_MIB_FRAGFAILS);dst_release (&rt->u.dst);return err; + +slow_path_clean: + skb_walk_frags(skb, frag2) { +if (frag2 == frag) +break ; + frag2->sk =NULL ; + frag2->destructor =NULL ; + skb->truesize += frag2->truesize; + } } slow_path:
Signature · 1 line
1.7.3.3
PATCH 189/260 x86, AMD, MCE thresholding: Fix the MCi_MISCj iteration order
In reply to Paul GortmakerFrom: Borislav Petkov <[email protected]>
commit 6dcbfe4f0b4e17e289d56fa534b7ce5a6b7f63a3 upstream.
This fixes possible cases of not collecting valid error info in the MCE error thresholding groups on F10h hardware.
The current code contains a subtle problem of checking only the Valid bit of MSR0000_0413 (which is MC4_MISC0 - DRAM thresholding group) in its first iteration and breaking out if the bit is cleared.
But (!), this MSR contains an offset value, BlkPtr[31:24], which points to the remaining MSRs in this thresholding group which might contain valid information too. But if we bail out only after we checked the valid bit in the first MSR and not the block pointer too, we miss that other information.
The thing is, MC4_MISC0[BlkPtr] is not predicated on MCi_STATUS[MiscV] or MC4_MISC0[Valid] and should be checked prior to iterating over the MCI_MISCj thresholding group, irrespective of the MC4_MISC0[Valid] setting.
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +3 -6
@@ -141,6 +141,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) address = (low &MASK_BLKPTR_LO ) >>21 ;if (!address)break ; + address +=MCG_XBLK_ADDR ; }else ++address;
@@ -148,12 +149,8 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)if (rdmsr_safe (address, &low, &high))break ; -if (!(high &MASK_VALID_HI )) { -if (block) -continue ; -else -break ; - } +if (!(high &MASK_VALID_HI )) +continue ;if (!(high &MASK_CNTP_HI ) || (high &MASK_LOCKED_HI ))
Signature · 1 line
1.7.3.3
PATCH 198/260 net: clear heap allocations for privileged ethtool actions
In reply to Paul GortmakerFrom: Kees Cook <[email protected]>
commit b00916b189d13a615ff05c9242201135992fcda3 upstream.
Several other ethtool functions leave heap uncleared (potentially) by drivers. Some interfaces appear safe (eeprom, etc), in that the sizes are well controlled. In some situations (e.g. unchecked error conditions), the heap will remain unchanged in areas before copying back to userspace. Note that these are less of an issue since these all require CAP_NET_ADMIN.
[PG: 34 doesn't have ethtool_get_rxnfc(), drop that chunk]
--- net/core/ethtool.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/core/ethtool.c +2 -2
@@ -464,7 +464,7 @@ static int ethtool_get_rx_ntuple(struct net_device *dev, void __user *useraddr) gstrings.len = ret; - data =kmalloc (gstrings.len *ETH_GSTRING_LEN ,GFP_USER ); + data =kzalloc (gstrings.len *ETH_GSTRING_LEN ,GFP_USER );if (!data)return -ENOMEM ;
@@ -701,7 +701,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)if (regs.len > reglen) regs.len = reglen; - regbuf =kmalloc (reglen,GFP_USER ); + regbuf =kzalloc (reglen,GFP_USER );if (!regbuf)return -ENOMEM ;
Signature · 1 line
1.7.3.3
PATCH 196/260 net: Fix IPv6 PMTU disc. w/ asymmetric routes
In reply to Paul GortmakerFrom: Maciej Żenczykowski <[email protected]>
commit ae878ae280bea286ff2b1e1cb6e609dd8cb4501d upstream.
--- net/ipv6/route.c | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-)
net/ipv6/route.c +24 -4
@@ -1561,14 +1561,13 @@ out:* i.e. Path MTU discovery */ -void rt6_pmtu_discovery (struct in6_addr *daddr,struct in6_addr *saddr, -struct net_device *dev,u32 pmtu) +static void rt6_do_pmtu_disc (struct in6_addr *daddr,struct in6_addr *saddr, +struct net *net,u32 pmtu,int ifindex) {struct rt6_info *rt, *nrt; -struct net *net =dev_net (dev);int allfrag =0 ; - rt =rt6_lookup (net, daddr, saddr, dev->ifindex,0 ); + rt =rt6_lookup (net, daddr, saddr, ifindex,0 );if (rt ==NULL )return ;
@@ -1636,6 +1635,27 @@ out:dst_release (&rt->u.dst); } +void rt6_pmtu_discovery (struct in6_addr *daddr,struct in6_addr *saddr, +struct net_device *dev,u32 pmtu) +{ +struct net *net =dev_net (dev); + +/* +* RFC 1981 states that a node "MUST reduce the size of the packets it +* is sending along the path" that caused the Packet Too Big message. +* Since it's not possible in the general case to determine which +* interface was used to send the original packet, we update the MTU +* on the interface that will be used to send future packets. We also +* update the MTU on the interface that received the Packet Too Big in +* case the original packet was forced out that interface with +* SO_BINDTODEVICE or similar. This is the next best thing to the +* correct behaviour, which would be to update the MTU on all +* interfaces. +*/ +rt6_do_pmtu_disc (daddr, saddr, net, pmtu,0 ); +rt6_do_pmtu_disc (daddr, saddr, net, pmtu, dev->ifindex); +} +/* * Misc support functions */
Signature · 1 line
1.7.3.3
PATCH 182/260 ring-buffer: Fix typo of time extends per page
In reply to Paul GortmakerFrom: Steven Rostedt <[email protected]>
commit d01343244abdedd18303d0323b518ed9cdcb1988 upstream.
Time stamps for the ring buffer are created by the difference between two events. Each page of the ring buffer holds a full 64 bit timestamp. Each event has a 27 bit delta stamp from the last event. The unit of time is nanoseconds, so 27 bits can hold ~134 milliseconds. If two events happen more than 134 milliseconds apart, a time extend is inserted to add more bits for the delta. The time extend has 59 bits, which is good for ~18 years.
Currently the time extend is committed separately from the event. If an event is discarded before it is committed, due to filtering, the time extend still exists. If all events are being filtered, then after ~134 milliseconds a new time extend will be added to the buffer.
This can only happen till the end of the page. Since each page holds a full timestamp, there is no reason to add a time extend to the beginning of a page. Time extends can only fill a page that has actual data at the beginning, so there is no fear that time extends will fill more than a page without any data.
When reading an event, a loop is made to skip over time extends since they are only used to maintain the time stamp and are never given to the caller. As a paranoid check to prevent the loop running forever, with the knowledge that time extends may only fill a page, a check is made that tests the iteration of the loop, and if the iteration is more than the number of time extends that can fit in a page a warning is printed and the ring buffer is disabled (all of ftrace is also disabled with it).
There is another event type that is called a TIMESTAMP which can hold 64 bits of data in the theoretical case that two events happen 18 years apart. This code has not been implemented, but the name of this event exists, as well as the structure for it. The size of a TIMESTAMP is 16 bytes, where as a time extend is only 8 bytes. The macro used to calculate how many time extends can fit on a page used the TIMESTAMP size instead of the time extend size cutting the amount in half.
The following test case can easily trigger the warning since we only need to have half the page filled with time extends to trigger the warning:
# cd /sys/kernel/debug/tracing/ # echo function > current_tracer # echo 'common_pid < 0' > events/ftrace/function/filter # echo > trace # echo 1 > trace_marker # sleep 120 # cat trace
Enabling the function tracer and then setting the filter to only trace functions where the process id is negative (no events), then clearing the trace buffer to ensure that we have nothing in the buffer, then write to trace_marker to add an event to the beginning of a page, sleep for 2 minutes (only 35 seconds is probably needed, but this guarantees the bug), and then finally reading the trace which will trigger the bug.
This patch fixes the typo and prevents the false positive of that warning.
--- kernel/trace/ring_buffer.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ring_buffer.c +1 -1
@@ -399,7 +399,7 @@ static inline int test_time_stamp(u64 delta)#define BUF_MAX_DATA_SIZE (BUF_PAGE_SIZE - (sizeof(u32) * 2))/* Max number of timestamps that can fit on a page */ -#define RB_TIMESTAMPS_PER_PAGE (BUF_PAGE_SIZE / RB_LEN_TIME_STAMP) +#define RB_TIMESTAMPS_PER_PAGE (BUF_PAGE_SIZE / RB_LEN_TIME_EXTEND)int ring_buffer_print_page_header (struct trace_seq *s) {
Signature · 1 line
1.7.3.3
PATCH 191/260 drm/radeon: fix PCI ID 5657 to be an RV410
In reply to Paul GortmakerFrom: Dave Airlie <[email protected]>
commit f459ffbdfd04edb4a8ce6eea33170eb057a5e695 upstream.
fixes https://bugzilla.kernel.org/show_bug.cgi?id=19012
--- include/drm/drm_pciids.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/drm/drm_pciids.h +1 -1
@@ -85,7 +85,6 @@ {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ - {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \ {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \ {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
@@ -103,6 +102,7 @@ {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x5652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \ {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ {0x1002, 0x5954, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
Signature · 1 line
1.7.3.3
PATCH 192/260 xfrm4: strip ECN bits from tos field
In reply to Paul GortmakerFrom: Ulrich Weber <[email protected]>
commit 94e2238969e89f5112297ad2a00103089dde7e8f upstream.
otherwise ECT(1) bit will get interpreted as RTO_ONLINK and routing will fail with XfrmOutBundleGenError.
--- net/ipv4/xfrm4_policy.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv4/xfrm4_policy.c +1 -1
@@ -82,7 +82,7 @@ __xfrm4_find_bundle(struct flowi *fl, struct xfrm_policy *policy)static int xfrm4_get_tos (struct flowi *fl) { -return fl->fl4_tos; +return IPTOS_RT_MASK & fl->fl4_tos;/* Strip ECN bits */ } static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst,
Signature · 1 line
1.7.3.3
PATCH 193/260 tcp: Fix >4GB writes on 64-bit.
In reply to Paul GortmakerFrom: David S. Miller <[email protected]>
commit 01db403cf99f739f86903314a489fb420e0e254f upstream.
Fixes kernel bugzilla #16603
tcp_sendmsg() truncates iov_len to an 'int' which a 4GB write to write zero bytes, for example.
There is also the problem higher up of how verify_iovec() works. It wants to prevent the total length from looking like an error return value.
However it does this using 'int', but syscalls return 'long' (and thus signed 64-bit on 64-bit machines). So it could trigger false-positives on 64-bit as written. So fix it to use 'long'.
--- include/linux/socket.h | 2 +- net/core/iovec.c | 5 +++-- net/ipv4/tcp.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
include/linux/socket.h +1 -1
@@ -314,7 +314,7 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,int offset, unsigned int len, __wsum *csump); -extern int verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr *address,int mode); +extern long verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr *address,int mode);extern int memcpy_toiovec (struct iovec *v,unsigned char *kdata,int len);extern int memcpy_toiovecend (const struct iovec *v,unsigned char *kdata,int offset,int len);
net/core/iovec.c +3 -2
@@ -35,9 +35,10 @@* in any case. */ -int verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr *address,int mode) +long verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr *address,int mode) { -int size, err, ct; +int size, ct; +long err;if (m->msg_namelen) {if (mode ==VERIFY_READ ) {
net/ipv4/tcp.c +1 -1
@@ -938,7 +938,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, sg = sk->sk_route_caps &NETIF_F_SG ;while (--iovlen >=0 ) { -int seglen = iov->iov_len; +size_t seglen = iov->iov_len;unsigned char __user *from = iov->iov_base; iov++;
Signature · 1 line
1.7.3.3
PATCH 185/260 i2c-pca: Fix waitforcompletion() return value
In reply to Paul GortmakerFrom: Yegor Yefremov <[email protected]>
commit 6abb930af064fb1cf4177d32e2c7bfb89eee0fe5 upstream.
ret is still -1, if during the polling read_byte() returns at once with I2C_PCA_CON_SI set. So ret > 0 would lead *_waitforcompletion() to return 0, in spite of the proper behavior.
The routine was rewritten, so that ret has always a proper value, before returning.
--- drivers/i2c/busses/i2c-pca-isa.c | 12 ++++++++---- drivers/i2c/busses/i2c-pca-platform.c | 11 +++++++---- 2 files changed, 15 insertions(+), 8 deletions(-)
drivers/i2c/busses/i2c-pca-isa.c +8 -4
@@ -71,8 +71,8 @@ static int pca_isa_readbyte(void *pd, int reg)static int pca_isa_waitforcompletion (void *pd) { -long ret = ~0 ;unsigned long timeout; +long ret;if (irq >-1 ) { ret = wait_event_timeout(pca_wait,
@@ -81,11 +81,15 @@ static int pca_isa_waitforcompletion(void *pd) }else {/* Do polling */ timeout = jiffies + pca_isa_ops.timeout; -while (((pca_isa_readbyte (pd,I2C_PCA_CON ) - &I2C_PCA_CON_SI ) ==0 ) - && (ret =time_before (jiffies, timeout))) +do { + ret =time_before (jiffies, timeout); +if (pca_isa_readbyte (pd,I2C_PCA_CON ) + &I2C_PCA_CON_SI ) +break ;udelay (100 ); + }while (ret); } +return ret >0 ; }
drivers/i2c/busses/i2c-pca-platform.c +7 -4
@@ -80,8 +80,8 @@ static void i2c_pca_pf_writebyte32(void *pd, int reg, int val)static int i2c_pca_pf_waitforcompletion (void *pd) {struct i2c_pca_pf_data *i2c = pd; -long ret = ~0 ;unsigned long timeout; +long ret;if (i2c->irq) { ret = wait_event_timeout(i2c->wait,
@@ -90,10 +90,13 @@ static int i2c_pca_pf_waitforcompletion(void *pd) }else {/* Do polling */ timeout = jiffies + i2c->adap.timeout; -while (((i2c->algo_data.read_byte (i2c,I2C_PCA_CON ) - &I2C_PCA_CON_SI ) ==0 ) - && (ret =time_before (jiffies, timeout))) +do { + ret =time_before (jiffies, timeout); +if (i2c->algo_data.read_byte (i2c,I2C_PCA_CON ) + &I2C_PCA_CON_SI ) +break ;udelay (100 ); + }while (ret); }return ret >0 ;
Signature · 1 line
1.7.3.3
PATCH 179/260 x86, hpet: Fix bogus error check in hpet_assign_irq()
In reply to Paul GortmakerFrom: Thomas Gleixner <[email protected]>
commit 021989622810b02aab4b24f91e1f5ada2b654579 upstream.
create_irq() returns -1 if the interrupt allocation failed, but the code checks for irq == 0.
Use create_irq_nr() instead.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/hpet.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/hpet.c +1 -1
@@ -499,7 +499,7 @@ static int hpet_assign_irq(struct hpet_dev *dev) {unsigned int irq; - irq =create_irq (); + irq =create_irq_nr (0 ,-1 );if (!irq)return -EINVAL ;
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 186/260 ocfs2: Don't walk off the end of fast symlinks.
In reply to Paul GortmakerFrom: Joel Becker <[email protected]>
commit 1fc8a117865b54590acd773a55fbac9221b018f0 upstream.
ocfs2 fast symlinks are NUL terminated strings stored inline in the inode data area. However, disk corruption or a local attacker could, in theory, remove that NUL. Because we're using strlen() (my fault, introduced in a731d1 when removing vfs_follow_link()), we could walk off the end of that string.
--- fs/ocfs2/symlink.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ocfs2/symlink.c +1 -1
@@ -128,7 +128,7 @@ static void *ocfs2_fast_follow_link(struct dentry *dentry, }/* Fast symlinks can't be large */ - len =strlen (target); + len =strnlen (target,ocfs2_fast_symlink_chars (inode->i_sb)); link =kzalloc (len +1 ,GFP_NOFS );if (!link) { status = -ENOMEM ;
Signature · 1 line
1.7.3.3
PATCH 175/260 tracing/x86: Don't use mcount in kvmclock.c
In reply to Paul GortmakerFrom: Steven Rostedt <[email protected]>
commit 258af47479980d8238a04568b94a4e55aa1cb537 upstream.
The guest can use the paravirt clock in kvmclock.c which is used by sched_clock(), which in turn is used by the tracing mechanism for timestamps, which leads to infinite recursion.
Disable mcount/tracing for kvmclock.o.
--- arch/x86/kernel/Makefile | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kernel/Makefile +1 -0
@@ -12,6 +12,7 @@ CFLAGS_REMOVE_tsc.o = -pg CFLAGS_REMOVE_rtc.o = -pg CFLAGS_REMOVE_paravirt-spinlocks.o = -pg CFLAGS_REMOVE_pvclock.o = -pg +CFLAGS_REMOVE_kvmclock.o = -pg CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_early_printk.o = -pg endif
Signature · 1 line
1.7.3.3
PATCH 166/260 usb: musb: gadget: fix kernel panic if using out ep with FIFO_TXRX style
In reply to Paul GortmakerFrom: Ming Lei <[email protected]>
commit bd2e74d657fc7d514881cc2117e323790b257914 upstream.
For shared fifo hw endpoint(with FIFO_TXRX style), only ep_in field of musb_hw_ep is intialized in musb_g_init_endpoints, and ep_out is not initialized, but musb_g_rx and rxstate may access ep_out field of musb_hw_ep by the method below:
musb_ep = &musb->endpoints[epnum].ep_out
which can cause the kernel panic[1] below, this patch fixes the issue by getting 'musb_ep' from '&musb->endpoints[epnum].ep_in' for shared fifo endpoint.
[1], kernel panic
[root@OMAP3EVM /]# musb_interrupt 1583: ** IRQ peripheral usb0008 tx0000 rx4000 musb_stage0_irq 460: <== Power=f0, DevCtl=99, int_usb=0x8 musb_g_rx 772: <== (null), rxcsr 4007 ffffffe8musb_g_rx 786: iso overrun on ffffffe8
Unable to handle kernel NULL pointer dereference at virtual address 00000008 pgd = c0004000 [00000008] *pgd=00000000 Internal error: Oops: 17 [#1] PREEMPT last sysfs file: /sys/devices/platform/musb_hdrc/usb1/usb_device/usbdev1.1/dev Modules linked in: g_zero CPU: 0 Tainted: G W (2.6.35-rc6-gkh-wl+ #92) PC is at musb_g_rx+0xfc/0x2ec LR is at vprintk+0x3f4/0x458 pc : [<c02c07a4>] lr : [<c006ccb0>] psr: 20000193
sp : c760bd78 ip : c03c9d70 fp : c760bdbc
r10: 00000000 r9 : fa0ab1e0 r8 : 0000000e
r7 : c7e80158 r6 : ffffffe8 r5 : 00000001 r4 : 00004003 r3 : 00010003 r2 : c760bcd8 r1 : c03cd030 r0 : 0000002e
Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c5387d Table: 8778c019 DAC: 00000017
Process kmemleak (pid: 421, stack limit = 0xc760a2e8)
Stack: (0xc760bd78 to 0xc760c000)
bd60: ffffffe8 c04b1b58
bd80: ffffffe8 c7c01ac0 00000000 c7e80d24 c0084238 00000001 00000001 c7e80158
bda0: 0000000e 00000008 00000099 000000f0 c760be04 c760bdc0 c02bcd68 c02c06b4
bdc0: 00000099 00000008 00004000 c760bdd8 c03cc4f8 00000000 00000002 c7e80158
bde0: c7d2e300 60000193 c760a000 0000005c 00000000 00000000 c760be24 c760be08
be00: c02bcecc c02bc1ac c7d2e300 c7d2e300 0000005c c760a000 c760be54 c760be28
be20: c00ad698 c02bce6c 00000000 c7d2e300 c067c258 0000005c c067c294 00000001
be40: c760a000 00000000 c760be74 c760be58 c00af984 c00ad5fc 0000005c 00000000
be60: 00000000 00000002 c760be8c c760be78 c0039080 c00af8d0 ffffffff fa200000
be80: c760beec c760be90 c0039b6c c003900c 00000001 00000000 c7d1e240 00000000
bea0: 00000000 c068bae8 00000000 60000013 00000001 00000000 00000000 c760beec
bec0: c0064ecc c760bed8 c00ff7d0 c003a0a8 60000013 ffffffff 00000000 c068bae8
bee0: c760bf24 c760bef0 c00ff7d0 c0064ec4 00000001 00000000 c00ff700 00000000
bf00: c0087f00 00000000 60000013 c0d76a70 c0e23795 00000001 c760bf4c c760bf28
bf20: c00ffdd8 c00ff70c c068bb08 c068bae8 60000013 c0100938 c068bb30 00000000
bf40: c760bf84 c760bf50 c010014c c00ffd84 00000001 00000000 c010000c 00012c00
bf60: c7c33f04 00012c00 c7c33f04 00000000 c0100938 00000000 c760bf9c c760bf88
bf80: c01009a8 c0100018 c760bfa8 c7c33f04 c760bff4 c760bfa0 c0088000 c0100944
bfa0: c760bf98 00000000 00000000 00000001 dead4ead ffffffff ffffffff c08ba2bc
bfc0: 00000000 c049e7fa 00000000 c0087f70 c760bfd0 c760bfd0 c7c33f04 c0087f70
bfe0: c006f5e8 00000013 00000000 c760bff8 c006f5e8 c0087f7c 7f0004ff df2000ff
Backtrace: [<c02c06a8>] (musb_g_rx+0x0/0x2ec) from [<c02bcd68>] (musb_interrupt+0xbc8/0xcc0) [<c02bc1a0>] (musb_interrupt+0x0/0xcc0) from [<c02bcecc>] (generic_interrupt+0x6c/0x84) [<c02bce60>] (generic_interrupt+0x0/0x84) from [<c00ad698>] (handle_IRQ_event+0xa8/0x1ec) r7:c760a000 r6:0000005c r5:c7d2e300 r4:c7d2e300 [<c00ad5f0>] (handle_IRQ_event+0x0/0x1ec) from [<c00af984>] (handle_level_irq+0xc0/0x13c) [<c00af8c4>] (handle_level_irq+0x0/0x13c) from [<c0039080>] (asm_do_IRQ+0x80/0xa0) r7:00000002 r6:00000000 r5:00000000 r4:0000005c [<c0039000>] (asm_do_IRQ+0x0/0xa0) from [<c0039b6c>] (__irq_svc+0x4c/0xb4) Exception stack(0xc760be90 to 0xc760bed8)
be80: 00000001 00000000 c7d1e240 00000000
bea0: 00000000 c068bae8 00000000 60000013 00000001 00000000 00000000 c760beec
bec0: c0064ecc c760bed8 c00ff7d0 c003a0a8 60000013 ffffffff
r5:fa200000 r4:ffffffff
[<c0064eb8>] (sub_preempt_count+0x0/0x100) from [<c00ff7d0>] (find_and_get_object+0xd0/0x110)
r5:c068bae8 r4:00000000
[<c00ff700>] (find_and_get_object+0x0/0x110) from [<c00ffdd8>] (scan_block+0x60/0x104)
r8:00000001 r7:c0e23795 r6:c0d76a70 r5:60000013 r4:00000000
[<c00ffd78>] (scan_block+0x0/0x104) from [<c010014c>] (kmemleak_scan+0x140/0x484) [<c010000c>] (kmemleak_scan+0x0/0x484) from [<c01009a8>] (kmemleak_scan_thread+0x70/0xcc)
r8:00000000 r7:c0100938 r6:00000000 r5:c7c33f04 r4:00012c00
[<c0100938>] (kmemleak_scan_thread+0x0/0xcc) from [<c0088000>] (kthread+0x90/0x98)
r5:c7c33f04 r4:c760bfa8
[<c0087f70>] (kthread+0x0/0x98) from [<c006f5e8>] (do_exit+0x0/0x684)
r7:00000013 r6:c006f5e8 r5:c0087f70 r4:c7c33f04
Code: e3002312 e58d6000 e2833e16 eb0422d5 (e5963020) ---[ end trace f3d5e96f75c297b7 ]---
--- drivers/usb/musb/musb_gadget.c | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-)
drivers/usb/musb/musb_gadget.c +17 -3
@@ -568,11 +568,19 @@ static void rxstate(struct musb *musb, struct musb_request *req) {const u8 epnum = req->epnum;struct usb_request *request = &req->request; -struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; +struct musb_ep *musb_ep;void __iomem *epio = musb->endpoints[epnum].regs;unsigned fifo_count =0 ; -u16 len = musb_ep->packet_sz; +u16 len;u16 csr =musb_readw (epio,MUSB_RXCSR ); +struct musb_hw_ep *hw_ep = &musb->endpoints[epnum]; + +if (hw_ep->is_shared_fifo) + musb_ep = &hw_ep->ep_in; +else + musb_ep = &hw_ep->ep_out; + + len = musb_ep->packet_sz;/* We shouldn't get here while DMA is active, but we do... */ if (dma_channel_status (musb_ep->dma) ==MUSB_DMA_STATUS_BUSY ) {
@@ -740,9 +748,15 @@ void musb_g_rx(struct musb *musb, u8 epnum)u16 csr;struct usb_request *request;void __iomem *mbase = musb->mregs; -struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; +struct musb_ep *musb_ep;void __iomem *epio = musb->endpoints[epnum].regs;struct dma_channel *dma; +struct musb_hw_ep *hw_ep = &musb->endpoints[epnum]; + +if (hw_ep->is_shared_fifo) + musb_ep = &hw_ep->ep_in; +else + musb_ep = &hw_ep->ep_out;musb_ep_select (mbase, epnum);
Signature · 1 line
1.7.3.3
PATCH 181/260 ubd: fix incorrect sector handling during request restart
In reply to Paul GortmakerFrom: Tejun Heo <[email protected]>
commit 47526903feb52f4c26a6350370bdf74e337fcdb1 upstream.
Commit f81f2f7c (ubd: drop unnecessary rq->sector manipulation) dropped request->sector manipulation in preparation for global request handling cleanup; unfortunately, it incorrectly assumed that the updated sector wasn't being used.
ubd tries to issue as many requests as possible to io_thread. When issuing fails due to memory pressure or other reasons, the device is put on the restart list and issuing stops. On IO completion, devices on the restart list are scanned and IO issuing is restarted.
ubd issues IOs sg-by-sg and issuing can be stopped in the middle of a request, so each device on the restart queue needs to remember where to restart in its current request. ubd needs to keep track of the issue position itself because,
* blk_rq_pos(req) is now updated by the block layer to keep track of _completion_ position.
* Multiple io_req's for the current request may be in flight, so it's difficult to tell where blk_rq_pos(req) currently is.
Add ubd->rq_pos to keep track of the issue position and use it to correctly restart io_req issue.
--- arch/um/drivers/ubd_kern.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
arch/um/drivers/ubd_kern.c +5 -4
@@ -162,6 +162,7 @@ struct ubd {struct scatterlist sg[MAX_SG ];struct request *request;int start_sg, end_sg; +sector_t rq_pos; };#define DEFAULT_COW { \
@@ -186,6 +187,7 @@ struct ubd { .request = NULL, \ .start_sg = 0, \ .end_sg = 0, \ + .rq_pos = 0, \ }/* Protected by ubd_lock */
@@ -1223,7 +1225,6 @@ static void do_ubd_request(struct request_queue *q) {struct io_thread_req *io_req;struct request *req; -sector_t sector;int n;while (1 ){
@@ -1234,12 +1235,12 @@ static void do_ubd_request(struct request_queue *q)return ; dev->request = req; + dev->rq_pos =blk_rq_pos (req); dev->start_sg =0 ; dev->end_sg =blk_rq_map_sg (q, req, dev->sg); } req = dev->request; - sector =blk_rq_pos (req);while (dev->start_sg < dev->end_sg){struct scatterlist *sg = &dev->sg[dev->start_sg];
@@ -1251,10 +1252,9 @@ static void do_ubd_request(struct request_queue *q)return ; }prepare_request (req, io_req, - (unsigned long long )sector <<9 , + (unsigned long long )dev->rq_pos <<9 , sg->offset, sg->length,sg_page (sg)); - sector += sg->length >>9 ; n =os_write_file (thread_fd, &io_req,sizeof (struct io_thread_req *));if (n !=sizeof (struct io_thread_req *)){
@@ -1267,6 +1267,7 @@ static void do_ubd_request(struct request_queue *q)return ; } + dev->rq_pos += sg->length >>9 ; dev->start_sg++; } dev->end_sg =0 ;
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 178/260 Input: joydev - fix JSIOCSAXMAP ioctl
In reply to Paul GortmakerFrom: Kenneth Waters <[email protected]>
commit d2520a426dc3033c00077e923a553fc6c98c7564 upstream.
Fixed JSIOCSAXMAP ioctl to update absmap, the map from hardware axis to event axis in addition to abspam. This fixes a regression introduced by 999b874f.
--- drivers/input/joydev.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/input/joydev.c +3 -0
@@ -483,6 +483,9 @@ static int joydev_handle_JSIOCSAXMAP(struct joydev *joydev,memcpy (joydev->abspam, abspam, len); +for (i =0 ; i < joydev->nabs; i++) + joydev->absmap[joydev->abspam[i]] = i; + out:kfree (abspam);return retval;
Signature · 1 line
1.7.3.3
PATCH 170/260 mmc: sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove
In reply to Paul GortmakerFrom: Marek Szyprowski <[email protected]>
commit 9320f7cbbdd5febf013b0e91db29189724057738 upstream.
If not all clocks have been defined in platform data, the driver will cause a null pointer dereference when it is removed. This patch fixes this issue.
--- drivers/mmc/host/sdhci-s3c.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-s3c.c +4 -2
@@ -380,8 +380,10 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)sdhci_remove_host (host,1 );for (ptr =0 ; ptr <3 ; ptr++) { -clk_disable (sc->clk_bus[ptr]); -clk_put (sc->clk_bus[ptr]); +if (sc->clk_bus[ptr]) { +clk_disable (sc->clk_bus[ptr]); +clk_put (sc->clk_bus[ptr]); + } }clk_disable (sc->clk_io);clk_put (sc->clk_io);
Signature · 1 line
1.7.3.3
PATCH 168/260 oprofile: Add Support for Intel CPU Family 6 / Model 29
In reply to Paul GortmakerFrom: Jiri Olsa <[email protected]>
commit bb7ab785ad05a97a2c9ffb3a06547ed39f3133e8 upstream.
This patch adds CPU type detection for dunnington processor (Family 6 / Model 29) to be identified as core 2 family cpu type (wikipedia source).
I tested oprofile on Intel(R) Xeon(R) CPU E7440 reporting itself as model 29, and it runs without an issue.
Spec:
http://www.intel.com/Assets/en_US/PDF/specupdate/320336.pdf
--- arch/x86/oprofile/nmi_int.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/oprofile/nmi_int.c +1 -0
@@ -624,6 +624,7 @@ static int __init ppro_init(char **cpu_type)case 0x0f :case 0x16 :case 0x17 : +case 0x1d : *cpu_type ="i386/core_2" ;break ;case 0x1a :
Signature · 1 line
1.7.3.3
PATCH 165/260 USB: fix bug in initialization of interface minor numbers
In reply to Paul GortmakerFrom: Alan Stern <[email protected]>
commit 0026e00523a85b90a92a93ddf6660939ecef3e54 upstream.
Recent changes in the usbhid layer exposed a bug in usbcore. If CONFIG_USB_DYNAMIC_MINORS is enabled then an interface may be assigned a minor number of 0. However interfaces that aren't registered as USB class devices also have their minor number set to 0, during initialization. As a result usb_find_interface() may return the wrong interface, leading to a crash.
This patch (as1418) fixes the problem by initializing every interface's minor number to -1. It also cleans up the usb_register_dev() function, which besides being somewhat awkwardly written, does not unwind completely on all its error paths.
--- drivers/usb/core/file.c | 35 ++++++++++++++++------------------- drivers/usb/core/message.c | 1 + 2 files changed, 17 insertions(+), 19 deletions(-)
drivers/usb/core/file.c +16 -19
@@ -159,9 +159,9 @@ void usb_major_cleanup(void)int usb_register_dev (struct usb_interface *intf,struct usb_class_driver *class_driver) { -int retval = -EINVAL ; +int retval;int minor_base = class_driver->minor_base; -int minor =0 ; +int minor;char name[20 ];char *temp;
@@ -173,12 +173,17 @@ int usb_register_dev(struct usb_interface *intf,*/ minor_base =0 ;#endif - intf->minor =-1 ; - -dbg ("looking for a minor, starting at %d" , minor_base);if (class_driver->fops ==NULL ) - goto exit; +return -EINVAL ; +if (intf->minor >=0 ) +return -EADDRINUSE ; + + retval =init_usb_class (); +if (retval) +return retval; + +dev_dbg (&intf->dev,"looking for a minor, starting at %d" , minor_base);down_write (&minor_rwsem);for (minor = minor_base; minor <MAX_USB_MINORS ; ++minor) {
@@ -186,20 +191,12 @@ int usb_register_dev(struct usb_interface *intf,continue ; usb_minors[minor] = class_driver->fops; - - retval =0 ; + intf->minor = minor;break ; }up_write (&minor_rwsem); - -if (retval) - goto exit; - - retval =init_usb_class (); -if (retval) - goto exit; - - intf->minor = minor; +if (intf->minor <0 ) +return -EXFULL ;/* create a usb class device for this usb interface */ snprintf (name,sizeof (name), class_driver->name, minor - minor_base);
@@ -213,11 +210,11 @@ int usb_register_dev(struct usb_interface *intf, "%s", temp);if (IS_ERR (intf->usb_dev)) {down_write (&minor_rwsem); - usb_minors[intf->minor] =NULL ; + usb_minors[minor] =NULL ; + intf->minor =-1 ;up_write (&minor_rwsem); retval =PTR_ERR (intf->usb_dev); } -exit:return retval; }EXPORT_SYMBOL_GPL (usb_register_dev);
drivers/usb/core/message.c +1 -0
@@ -1817,6 +1817,7 @@ free_interfaces: intf->dev.groups = usb_interface_groups; intf->dev.dma_mask = dev->dev.dma_mask;INIT_WORK (&intf->reset_ws, __usb_queue_reset_device); + intf->minor =-1 ;device_initialize (&intf->dev); dev_set_name(&intf->dev, "%d-%s:%d.%d", dev->bus->busnum, dev->devpath,
Signature · 1 line
1.7.3.3