v2.6.34.14 longterm review
Subsystems (46)
cover v2.6.34.14 longterm review
This is the start of the longterm review cycle for the v2.6.34.14 release. There are 77 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.
The full queue can be found at:
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
Please try to get reponses made within 72 hours, or it may be too late.
Thanks,
Paul.
---
Andrea Arcangeli (1):
ext4: avoid hangs in ext4_da_should_update_i_disksize()
Bankim Bhavsar (1):
ALSA: hda - Add support for VMware controller
Bart Westgeest (1):
staging: usbip: bugfix for deadlock
Benjamin Poirier (1):
gro: reset vlan_tci on reuse
Bernd Porr (1):
staging: comedi: fix oops for USB DAQ devices.
Bjorn Helgaas (2):
PCI hotplug: shpchp: don't blindly claim non-AMD 0x7450 device IDs x86/mpparse: Account for bus types other than ISA and PCI
Chanho Min (1):
sched/rt: Fix task stack corruption under
__ARCH_WANT_INTERRUPTS_ON_CTXSW
Christoph Hellwig (1):
xfs: validate acl count
Dan Carpenter (1):
USB: whci-hcd: fix endian conversion in qset_clear()
Daniel T Chen (1):
ALSA: hda: Use position_fix=1 for Acer Aspire 5538 to enable capture
on internal mic
David Dillow (1):
ALSA: sis7019 - give slow codecs more time to reset
Eliad Peller (1):
nl80211: fix MAC address validation
Eric Paris (1):
inotify: stop kernel memory leak on file creation failure
Eric W. Biederman (1):
net: Fix ip link add netns oops
Eryu Guan (1):
jbd/jbd2: validate sb->s_first in journal_get_superblock()
Federico Vaga (1):
Staging: comedi: fix signal handling in read and write
Hannes Reinecke (1):
Silencing 'killing requests for dead queue'
Hans Verkuil (1):
ARM: davinci: dm646x evm: wrong register used in
setup_vpif_input_channel_mode
Hector Palacios (1):
timekeeping: add arch_offset hook to ktime_get functions
Ido Yariv (1):
genirq: Fix race condition when stopping the irq thread
Jacek Luczak (1):
SCTP: fix race between sctp_bind_addr_free() and
sctp_bind_addr_conflict()
Jan Kara (2):
udf: Fortify loading of sparing table
udf: Avoid run away loop when partition table length is corrupted
Jan Kiszka (1):
KVM: x86: Prevent starting PIT timers in the absence of irqchip
support
Jason Wang (1):
net: sock: validate data_len before allocating skb in
sock_alloc_send_pskb()
Jeffrey (Sheng-Hui) Chu (1):
i2c-algo-bit: Generate correct i2c address sequence for 10-bit target
John Stultz (3):
time: Improve sanity checking of timekeeping inputs
time: Avoid making adjustments if we haven't accumulated anything
time: Move ktime_t overflow checking into timespec_valid_strict
Krzysztof Hałasa (1):
USB: cdc-acm: add IDs for Motorola H24 HSPA USB module.
Linus Torvalds (2):
linux/log2.h: Fix rounddown_pow_of_two(1)
Make TASKSTATS require root access
Marcin Kościelnicki (1):
usb: ftdi_sio: add PID for Propox ISPcable III
Matthew Garrett (1):
x86: Don't use the EFI reboot method by default
Michael Büsch (2):
p54spi: Add missing spin_lock_init
p54spi: Fix workqueue deadlock
Neil Horman (1):
sctp: Fix list corruption resulting from freeing an association on a
list
NeilBrown (2):
md: Fix handling for devices from 2TB to 4TB in 0.90 metadata.
md: Don't truncate size at 4TB for RAID0 and Linear
Nick Bowler (1):
crypto: ghash - Avoid null pointer dereference if no key is set
Otavio Salvador (1):
ALSA: hda: add Vortex86MX PCI ids
Peter Zijlstra (2):
perf_events: Fix races in group composition
perf: Fix tear-down of inherited group events
Phillip Lougher (1):
hfs: fix hfs_find_init() sb->ext_tree NULL ptr oops
Qinglin Ye (1):
USB: usb-storage: unusual_devs entry for Kingston DT 101 G2
Richard Weinberger (2):
um: Use RWSEM_GENERIC_SPINLOCK on x86
x86: Get rid of asmregparm
Robert Richter (4):
oprofile, x86: Fix crash when unloading module (nmi timer mode)
oprofile: Free potentially owned tasks in case of errors
oprofile: Fix locking dependency in sync_start() oprofile, x86: Fix nmi-unsafe callgraph support
Salman Qazi (1):
sched, x86: Avoid unnecessary overflow in sched_clock
Seth Heasley (2):
ALSA: hda_intel: ALSA HD Audio patch for Intel Patsburg DeviceIDs
ALSA: hda - ALSA HD Audio patch for Intel Panther Point DeviceIDs
Stanislaw Gruszka (1):
sched: fix divide by zero at {thread_group,task}_times
Suresh Jayaraman (1):
cifs: fix cifs stable patch
cifs-fix-oplock-break-handling-try-2.patch
Suresh Siddha (1):
x86, ioapic: initialize nr_ioapic_registers early in
mp_register_ioapic()
Takashi Iwai (2):
ALSA: hda - Reduce pci id list for Intel with class id
ALSA: hda/realtek - Fix Oops in alc_mux_select()
Tejun Heo (2):
percpu: fix first chunk match in per_cpu_ptr_to_phys()
percpu: fix chunk range calculation
Thadeu Lima de Souza Cascardo (1):
genalloc: stop crashing the system when destroying a pool
Thomas Gleixner (2):
tick-broadcast: Stop active broadcast device when replacing it
rwsem: Remove redundant asmregparm annotation
Thomas Graf (2):
sctp: ABORT if receive, reassmbly, or reodering queue is not empty
while closing socket
sctp: Enforce retransmission limit during shutdown
Tim Blechmann (1):
ALSA: lx6464es - fix device communication via command bus
Trond Myklebust (1):
SUNRPC: Ensure we return EAGAIN in xs_nospace if congestion is
cleared
Tushar Gohad (1):
xfrm: Fix key lengths for rfc3686(ctr(aes))
Tyler Hicks (1):
eCryptfs: Extend array bounds for all filename chars
Veli-Pekka Peltola (1):
usb: option: add SIMCom SIM5218
Wei Yongjun (1):
sctp: malloc enough room for asconf-ack chunk
Will Deacon (2):
ARM: 7161/1: errata: no automatic store buffer drain
mutex: Place lock in contended state after fastpath_lock failure
Xi Wang (1):
xfs: fix acl count validation in xfs_acl_from_disk()
Xiao Guangrong (1):
export __get_user_pages_fast() function
arch/arm/Kconfig | 12 ++++ arch/arm/kernel/process.c | 3 + arch/arm/mach-davinci/board-dm646x-evm.c | 6 +- arch/um/Kconfig.x86 | 4 +- arch/x86/include/asm/linkage.h | 5 -- arch/x86/include/asm/rwsem.h | 12 ++-- arch/x86/include/asm/timer.h | 23 ++++++- arch/x86/kernel/apic/io_apic.c | 9 ++- arch/x86/kernel/efi.c | 3 - arch/x86/kernel/mpparse.c | 2 +- arch/x86/kernel/ptrace.c | 4 +- arch/x86/kvm/i8254.c | 10 ++- arch/x86/oprofile/backtrace.c | 46 ++++++++++++-- arch/x86/oprofile/init.c | 7 ++- crypto/ghash-generic.c | 6 ++ drivers/i2c/algos/i2c-algo-bit.c | 4 +- drivers/md/md.c | 15 ++++- drivers/net/wireless/p54/p54spi.c | 5 +- drivers/oprofile/buffer_sync.c | 21 ++++--- drivers/pci/hotplug/shpchp_core.c | 4 +- drivers/pci/hotplug/shpchp_hpc.c | 4 +- drivers/scsi/scsi_lib.c | 3 +- drivers/staging/comedi/comedi_fops.c | 75 ++++++++++++++++------ drivers/staging/usbip/vhci_rx.c | 10 +-- drivers/usb/class/cdc-acm.c | 10 +++ drivers/usb/host/whci/qset.c | 2 +- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 1 + drivers/usb/serial/option.c | 1 + drivers/usb/storage/unusual_devs.h | 7 +++ fs/cifs/misc.c | 3 + fs/ecryptfs/crypto.c | 4 +- fs/ext4/inode.c | 2 +- fs/hfs/btree.c | 20 ++++-- fs/jbd/journal.c | 8 +++ fs/jbd2/journal.c | 8 +++ fs/notify/inotify/inotify_user.c | 1 + fs/udf/super.c | 96 ++++++++++++++++++---------- fs/xfs/linux-2.6/xfs_acl.c | 4 +- include/asm-generic/mutex-xchg.h | 11 +++- include/linux/ktime.h | 7 --- include/linux/linkage.h | 4 -- include/linux/log2.h | 1 - include/linux/perf_event.h | 4 ++ include/linux/time.h | 29 ++++++++- include/net/sctp/command.h | 1 + include/net/sctp/ulpevent.h | 2 +- kernel/irq/manage.c | 5 +- kernel/perf_event.c | 104 ++++++++++++++++++++++--------- kernel/sched.c | 34 +++++----- kernel/sched_rt.c | 5 ++ kernel/taskstats.c | 1 + kernel/time/tick-broadcast.c | 2 +- kernel/time/timekeeping.c | 23 ++++++- lib/genalloc.c | 2 +- lib/rwsem.c | 10 ++- mm/percpu.c | 64 ++++++++++++++----- mm/util.c | 13 ++++ net/core/dev.c | 1 + net/core/rtnetlink.c | 3 + net/core/sock.c | 7 ++- net/sctp/bind_addr.c | 10 ++- net/sctp/input.c | 7 +-- net/sctp/outqueue.c | 20 +++++- net/sctp/sm_make_chunk.c | 4 +- net/sctp/sm_sideeffect.c | 20 +++++- net/sctp/sm_statefuns.c | 32 +++++++--- net/sctp/sm_statetable.c | 2 +- net/sctp/socket.c | 25 +++++--- net/sctp/ulpevent.c | 16 ++++- net/sunrpc/xprtsock.c | 3 +- net/wireless/nl80211.c | 4 +- net/xfrm/xfrm_algo.c | 4 +- sound/pci/hda/hda_intel.c | 29 +++++---- sound/pci/hda/patch_realtek.c | 2 + sound/pci/lx6464es/lx_core.c | 16 +++-- sound/pci/sis7019.c | 64 +++++++++++++++---- 77 files changed, 769 insertions(+), 283 deletions(-)
Signature · 1 line
1.7.12.1
PATCH 1/77 net: sock: validate data_len before allocating skb in sock_alloc_send_pskb()
From: Jason Wang <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc upstream.
We need to validate the number of pages consumed by data_len, otherwise frags array could be overflowed by userspace. So this patch validate data_len and return -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS.
--- net/core/sock.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/core/sock.c +5 -2
@@ -1425,6 +1425,11 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,gfp_t gfp_mask;long timeo;int err; +int npages = (data_len + (PAGE_SIZE -1 )) >>PAGE_SHIFT ; + + err = -EMSGSIZE ; +if (npages >MAX_SKB_FRAGS ) + goto failure; gfp_mask = sk->sk_allocation;if (gfp_mask & __GFP_WAIT)
@@ -1443,14 +1448,12 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,if (atomic_read (&sk->sk_wmem_alloc) < sk->sk_sndbuf) { skb =alloc_skb (header_len, gfp_mask);if (skb) { -int npages;int i;/* No pages, we're done... */ if (!data_len)break ; - npages = (data_len + (PAGE_SIZE -1 )) >>PAGE_SHIFT ; skb->truesize += data_len;skb_shinfo (skb)->nr_frags = npages;for (i =0 ; i < npages; i++) {
Signature · 1 line
1.7.12.1
PATCH 2/77 time: Improve sanity checking of timekeeping inputs
In reply to Paul GortmakerFrom: John Stultz <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 4e8b14526ca7fb046a81c94002c1c43b6fdf0e9b upstream.
Unexpected behavior could occur if the time is set to a value large enough to overflow a 64bit ktime_t (which is something larger then the year 2262).
Also unexpected behavior could occur if large negative offsets are injected via adjtimex.
So this patch improves the sanity check timekeeping inputs by improving the timespec_valid() check, and then makes better use of timespec_valid() to make sure we don't set the time to an invalid negative value or one that overflows ktime_t.
Note: This does not protect from setting the time close to overflowing ktime_t and then letting natural accumulation cause the overflow.
--- include/linux/ktime.h | 7 ------- include/linux/time.h | 22 ++++++++++++++++++++-- kernel/time/timekeeping.c | 15 ++++++++++++++- 3 files changed, 34 insertions(+), 10 deletions(-)
include/linux/ktime.h +0 -7
@@ -58,13 +58,6 @@ union ktime {typedef union ktime ktime_t ;/* Kill this */ -#define KTIME_MAX ((s64)~((u64)1 << 63)) -#if (BITS_PER_LONG ==64 ) -# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) -#else -# define KTIME_SEC_MAX LONG_MAX -#endif -/* * ktime_t definitions when using the 64-bit scalar representation: */
include/linux/time.h +20 -2
@@ -91,11 +91,29 @@ static inline struct timespec timespec_sub(struct timespec lhs,return ts_delta; } +#define KTIME_MAX ((s64)~((u64)1 << 63)) +#if (BITS_PER_LONG ==64 ) +# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) +#else +# define KTIME_SEC_MAX LONG_MAX +#endif +/* * Returns true if the timespec is norm, false if denorm: */ -#define timespec_valid (ts) \ - (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) +static inline bool timespec_valid (const struct timespec *ts) +{ +/* Dates before 1970 are bogus */ +if (ts->tv_sec <0 ) +return false; +/* Can't have more nanoseconds then a second */ +if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC ) +return false; +/* Disallow values that could overflow ktime_t */ +if ((unsigned long long )ts->tv_sec >=KTIME_SEC_MAX ) +return false; +return true; +}extern struct timespec xtime;extern struct timespec wall_to_monotonic;
kernel/time/timekeeping.c +14 -1
@@ -343,7 +343,7 @@ int do_settimeofday(struct timespec *tv)struct timespec ts_delta;unsigned long flags; -if ((unsigned long )tv->tv_nsec >=NSEC_PER_SEC ) +if (!timespec_valid (tv))return -EINVAL ;write_seqlock_irqsave (&xtime_lock, flags);
@@ -559,7 +559,20 @@ void __init timekeeping_init(void)struct timespec now, boot;read_persistent_clock (&now); +if (!timespec_valid (&now)) { +printk ("WARNING: Persistent clock returned invalid value!\n" +" Check your CMOS/BIOS settings.\n" ); + now.tv_sec =0 ; + now.tv_nsec =0 ; + } +read_boot_clock (&boot); +if (!timespec_valid (&boot)) { +printk ("WARNING: Boot clock returned invalid value!\n" +" Check your CMOS/BIOS settings.\n" ); + boot.tv_sec =0 ; + boot.tv_nsec =0 ; + }write_seqlock_irqsave (&xtime_lock, flags);
Signature · 1 line
1.7.12.1
PATCH 3/77 time: Avoid making adjustments if we haven't accumulated anything
In reply to Paul GortmakerFrom: John Stultz <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit bf2ac312195155511a0f79325515cbb61929898a upstream.
If update_wall_time() is called and the current offset isn't large enough to accumulate, avoid re-calling timekeeping_adjust which may change the clock freq and can cause 1ns inconsistencies with CLOCK_REALTIME_COARSE/CLOCK_MONOTONIC_COARSE.
--- kernel/time/timekeeping.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/time/timekeeping.c +4 -0
@@ -849,6 +849,10 @@ void update_wall_time(void)#else offset = timekeeper.cycle_interval;#endif +/* Check if there's really nothing to do */ +if (offset < timekeeper.cycle_interval) +return ; + timekeeper.xtime_nsec = (s64 )xtime.tv_nsec << timekeeper.shift;/*
Signature · 1 line
1.7.12.1
PATCH 4/77 time: Move ktime_t overflow checking into timespec_valid_strict
In reply to Paul GortmakerFrom: John Stultz <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit cee58483cf56e0ba355fdd97ff5e8925329aa936 upstream.
Andreas Bombe reported that the added ktime_t overflow checking added to timespec_valid in commit 4e8b14526ca7 ("time: Improve sanity checking of timekeeping inputs") was causing problems with X.org because it caused timeouts larger then KTIME_T to be invalid.
Previously, these large timeouts would be clamped to KTIME_MAX and would never expire, which is valid.
This patch splits the ktime_t overflow checking into a new timespec_valid_strict function, and converts the timekeeping codes internal checking to use this more strict function.
--- include/linux/time.h | 7 +++++++ kernel/time/timekeeping.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-)
include/linux/time.h +7 -0
@@ -109,6 +109,13 @@ static inline bool timespec_valid(const struct timespec *ts)/* Can't have more nanoseconds then a second */ if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC )return false; +return true; +} + +static inline bool timespec_valid_strict (const struct timespec *ts) +{ +if (!timespec_valid (ts)) +return false;/* Disallow values that could overflow ktime_t */ if ((unsigned long long )ts->tv_sec >=KTIME_SEC_MAX )return false;
kernel/time/timekeeping.c +3 -3
@@ -343,7 +343,7 @@ int do_settimeofday(struct timespec *tv)struct timespec ts_delta;unsigned long flags; -if (!timespec_valid (tv)) +if (!timespec_valid_strict (tv))return -EINVAL ;write_seqlock_irqsave (&xtime_lock, flags);
@@ -559,7 +559,7 @@ void __init timekeeping_init(void)struct timespec now, boot;read_persistent_clock (&now); -if (!timespec_valid (&now)) { +if (!timespec_valid_strict (&now)) {printk ("WARNING: Persistent clock returned invalid value!\n" " Check your CMOS/BIOS settings.\n" ); now.tv_sec =0 ;
@@ -567,7 +567,7 @@ void __init timekeeping_init(void) }read_boot_clock (&boot); -if (!timespec_valid (&boot)) { +if (!timespec_valid_strict (&boot)) {printk ("WARNING: Boot clock returned invalid value!\n" " Check your CMOS/BIOS settings.\n" ); boot.tv_sec =0 ;
Signature · 1 line
1.7.12.1
PATCH 5/77 ALSA: hda_intel: ALSA HD Audio patch for Intel Patsburg DeviceIDs
In reply to Paul GortmakerFrom: Seth Heasley <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit cea310e8f8702226f982f09386cfd3c5793c5e2f upstream.
This patch adds the Intel Patsburg (PCH) HD Audio Controller DeviceIDs.
--- sound/pci/hda/hda_intel.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_intel.c +3 -0
@@ -126,6 +126,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},""{Intel, ICH10}," "{Intel, PCH}," "{Intel, CPT}," +"{Intel, PBG}," "{Intel, SCH}," "{ATI, SB450}," "{ATI, SB600},"
@@ -2730,6 +2731,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { { PCI_DEVICE(0x8086, 0x3b57), .driver_data = AZX_DRIVER_ICH }, /* CPT */ { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH }, + /* PBG */ + { PCI_DEVICE(0x8086, 0x1d20), .driver_data = AZX_DRIVER_PCH }, /* SCH */ { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH },/* ATI SB 450/600 */
Signature · 1 line
1.7.12.1
PATCH 6/77 ALSA: hda: add Vortex86MX PCI ids
In reply to Paul GortmakerFrom: Otavio Salvador <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit e35d4b119578a054515ccb4ed5dddc4e8a81ec15 upstream.
--- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/hda_intel.c +2 -0
@@ -2780,6 +2780,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { /* this entry seems still valid -- i.e. without emu20kx chip */ { PCI_DEVICE(0x1102, 0x0009), .driver_data = AZX_DRIVER_GENERIC }, #endif + /* Vortex86MX */ + { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC }, /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */ { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
Signature · 1 line
1.7.12.1
PATCH 7/77 ALSA: hda - Add support for VMware controller
In reply to Paul GortmakerFrom: Bankim Bhavsar <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 0f0714c5ed0a98fdeaa2287d3b159989bbe6d842 upstream.
Add the new PCI ID 0x15ad and device ID 0x1977 for VMware HDAudio Controller.
[changed to use AZX_DRIVER_GENERIC by tiwai]
--- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/hda_intel.c +2 -0
@@ -2782,6 +2782,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {#endif /* Vortex86MX */ { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC }, + /* VMware HDAudio */ + { PCI_DEVICE(0x15ad, 0x1977), .driver_data = AZX_DRIVER_GENERIC }, /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */ { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
Signature · 1 line
1.7.12.1
PATCH 8/77 ALSA: hda - Reduce pci id list for Intel with class id
In reply to Paul GortmakerFrom: Takashi Iwai <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit b686453543fd56332e8730a2abd7bf5bca756149 upstream.
Most of Intel controllers work as generic HD-audio without quirks, and it'll be hopefully so in future. Let's mark pci id with the PCI_CLASS_MULTIMEDIA_HD_AUDIO for Intel so that the driver will work with any new control chips in future.
--- sound/pci/hda/hda_intel.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
sound/pci/hda/hda_intel.c +5 -13
@@ -2716,25 +2716,17 @@ static void __devexit azx_remove(struct pci_dev *pci)/* PCI IDs */ static DEFINE_PCI_DEVICE_TABLE (azx_ids) = { -/* ICH 6..10 */ - {PCI_DEVICE (0x8086 ,0x2668 ), .driver_data =AZX_DRIVER_ICH }, - {PCI_DEVICE (0x8086 ,0x27d8 ), .driver_data =AZX_DRIVER_ICH }, - {PCI_DEVICE (0x8086 ,0x269a ), .driver_data =AZX_DRIVER_ICH }, - {PCI_DEVICE (0x8086 ,0x284b ), .driver_data =AZX_DRIVER_ICH }, - {PCI_DEVICE (0x8086 ,0x2911 ), .driver_data =AZX_DRIVER_ICH }, - {PCI_DEVICE (0x8086 ,0x293e ), .driver_data =AZX_DRIVER_ICH }, - {PCI_DEVICE (0x8086 ,0x293f ), .driver_data =AZX_DRIVER_ICH }, - {PCI_DEVICE (0x8086 ,0x3a3e ), .driver_data =AZX_DRIVER_ICH }, - {PCI_DEVICE (0x8086 ,0x3a6e ), .driver_data =AZX_DRIVER_ICH }, -/* PCH */ - {PCI_DEVICE (0x8086 ,0x3b56 ), .driver_data =AZX_DRIVER_ICH }, - {PCI_DEVICE (0x8086 ,0x3b57 ), .driver_data =AZX_DRIVER_ICH },/* CPT */ {PCI_DEVICE (0x8086 ,0x1c20 ), .driver_data =AZX_DRIVER_PCH },/* PBG */ {PCI_DEVICE (0x8086 ,0x1d20 ), .driver_data =AZX_DRIVER_PCH },/* SCH */ {PCI_DEVICE (0x8086 ,0x811b ), .driver_data =AZX_DRIVER_SCH }, +/* Generic Intel */ + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,PCI_ANY_ID ), + .class =PCI_CLASS_MULTIMEDIA_HD_AUDIO <<8 , + .class_mask =0xffffff , + .driver_data =AZX_DRIVER_ICH },/* ATI SB 450/600 */ {PCI_DEVICE (0x1002 ,0x437b ), .driver_data =AZX_DRIVER_ATI }, {PCI_DEVICE (0x1002 ,0x4383 ), .driver_data =AZX_DRIVER_ATI },
Signature · 1 line
1.7.12.1
PATCH 9/77 ALSA: hda - ALSA HD Audio patch for Intel Panther Point DeviceIDs
In reply to Paul GortmakerFrom: Seth Heasley <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit d2edeb7c6f1dada8ca7d5c23e42d604e92ae0c76 upstream.
This patch adds the HD Audio Controller DeviceIDs for the Intel Panther Point PCH.
--- sound/pci/hda/hda_intel.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_intel.c +3 -0
@@ -126,6 +126,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},""{Intel, ICH10}," "{Intel, PCH}," "{Intel, CPT}," +"{Intel, PPT}," "{Intel, PBG}," "{Intel, SCH}," "{ATI, SB450},"
@@ -2720,6 +2721,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH }, /* PBG */ { PCI_DEVICE(0x8086, 0x1d20), .driver_data = AZX_DRIVER_PCH }, + /* Panther Point */ + { PCI_DEVICE(0x8086, 0x1e20), .driver_data = AZX_DRIVER_PCH }, /* SCH */ { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH },/* Generic Intel */
Signature · 1 line
1.7.12.1
PATCH 10/77 ALSA: hda: Use position_fix=1 for Acer Aspire 5538 to enable capture on internal mic
In reply to Paul GortmakerFrom: Daniel T Chen <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit dd5a089edfa51a74692604b4b427953d8e16bc35 upstream.
The reporter of the bug states that he must use position_fix=1 to enable capture for the internal microphone, so set it for his machine's PCI SSID. Verified using 2.6.35 and the 2010-12-04 alsa-driver build.
--- sound/pci/hda/hda_intel.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/hda_intel.c +1 -0
@@ -2266,6 +2266,7 @@ static int azx_dev_free(struct snd_device *device)*/ static struct snd_pci_quirk position_fix_list[]__devinitdata = {SND_PCI_QUIRK (0x1025 ,0x009f ,"Acer Aspire 5110" ,POS_FIX_LPIB ), +SND_PCI_QUIRK (0x1025 ,0x026f ,"Acer Aspire 5538" ,POS_FIX_LPIB ),SND_PCI_QUIRK (0x1028 ,0x01cc ,"Dell D820" ,POS_FIX_LPIB ),SND_PCI_QUIRK (0x1028 ,0x01de ,"Dell Precision 390" ,POS_FIX_LPIB ),SND_PCI_QUIRK (0x1028 ,0x01f6 ,"Dell Latitude 131L" ,POS_FIX_LPIB ),
Signature · 1 line
1.7.12.1
PATCH 11/77 cifs: fix cifs stable patch cifs-fix-oplock-break-handling-try-2.patch
In reply to Paul GortmakerFrom: Suresh Jayaraman <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 4708ad6374f07cdfb379c5d4100125e2cfd339d9 in v2.6.32.x stable
The stable release 2.6.32.32 added the upstream commit 12fed00de963433128b5366a21a55808fab2f756. However, one of the hunks of the original patch seems missing from the stable backport which can be found here:
http://permalink.gmane.org/gmane.linux.kernel.stable/5676
This hunk corresponds to the change in is_valid_oplock_break() at fs/cifs/misc.c.
This patch backports the missing hunk and is against linux-2.6.32.y stable kernel.
[PG: I incorrectly dropped the same hunk in v2.6.34.9-152-g0c55f20
since the code in question was relocated/rewritten in e66673e39a ]
--- fs/cifs/misc.c | 3 +++ 1 file changed, 3 insertions(+)
fs/cifs/misc.c +3 -0
@@ -584,6 +584,9 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) pCifsInode->clientCanCacheAll = false;if (pSMB->OplockLevel ==0 ) pCifsInode->clientCanCacheRead = false; +else if (pSMB->OplockLevel) + pCifsInode->clientCanCacheRead = true; + rc =slow_work_enqueue (&netfile->oplock_break);if (rc) { cERROR(1, ("failed to enqueue oplock "
Signature · 1 line
1.7.12.1
PATCH 12/77 gro: reset vlan_tci on reuse
In reply to Paul GortmakerFrom: Benjamin Poirier <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------This one liner is part of upstream
commit 3701e51382a026cba10c60b03efabe534fba4ca4
Author: Jesse Gross <[email protected]>
vlan: Centralize handling of hardware acceleration.
The bulk of that commit is a rework of the hardware assisted vlan tagging driver interface, and as such doesn't classify for -stable inclusion. The fix that is needed is a part of that commit but can work independently of the rest.
This patch can avoid panics on the 2.6.32.y -stable kernels and is in the same spirit as mainline commits
66c46d7 gro: Reset dev pointer on reuse
6d152e2 gro: reset skb_iif on reuse
which are already in -stable.
For drivers using the vlan_gro_frags() interface, a packet with an invalid tci leads to GRO_DROP and napi_reuse_skb(). The skb has to be sanitized before being reused or we may send an skb with an invalid vlan_tci field up the stack where it is not expected.
--- net/core/dev.c | 1 + 1 file changed, 1 insertion(+)
net/core/dev.c +1 -0
@@ -2823,6 +2823,7 @@ void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) {__skb_pull (skb,skb_headlen (skb));skb_reserve (skb,NET_IP_ALIGN -skb_headroom (skb)); + skb->vlan_tci =0 ; skb->dev = napi->dev; skb->skb_iif =0 ;
Signature · 1 line
1.7.12.1
PATCH 13/77 md: Fix handling for devices from 2TB to 4TB in 0.90 metadata.
In reply to Paul GortmakerFrom: NeilBrown <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 27a7b260f71439c40546b43588448faac01adb93 upstream.
0.90 metadata uses an unsigned 32bit number to count the number of kilobytes used from each device.
This should allow up to 4TB per device.
However we multiply this by 2 (to get sectors) before casting to a larger type, so sizes above 2TB get truncated.
Also we allow rdev->sectors to be larger than 4TB, so it is possible for the array to be resized larger than the metadata can handle. So make sure rdev->sectors never exceeds 4TB when 0.90 metadata is in used.
Also the sanity check at the end of super_90_load should include level 1 as it used ->size too. (RAID0 and Linear don't use ->size at all).
--- drivers/md/md.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/md/md.c +10 -2
@@ -985,8 +985,11 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version ret =0 ; } rdev->sectors = rdev->sb_start; +/* Limit to 4TB as metadata cannot record more than that */ +if (rdev->sectors >= (2ULL <<32 )) + rdev->sectors = (2ULL <<32 ) -2 ; -if (rdev->sectors < sb->size *2 && sb->level >1 ) +if (rdev->sectors < ((sector_t )sb->size) *2 && sb->level >=1 )/* "this cannot possibly happen" ... */ ret = -EINVAL ;
@@ -1021,7 +1024,7 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) mddev->clevel[0 ] =0 ; mddev->layout = sb->layout; mddev->raid_disks = sb->raid_disks; - mddev->dev_sectors = sb->size *2 ; + mddev->dev_sectors = ((sector_t )sb->size) *2 ; mddev->events = ev1; mddev->bitmap_info.offset =0 ; mddev->bitmap_info.default_offset =MD_SB_BYTES >>9 ;
@@ -1260,6 +1263,11 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) rdev->sb_start =calc_dev_sboffset (rdev->bdev);if (!num_sectors || num_sectors > rdev->sb_start) num_sectors = rdev->sb_start; +/* Limit to 4TB as metadata cannot record more than that. +* 4TB == 2^32 KB, or 2*2^32 sectors. +*/ +if (num_sectors >= (2ULL <<32 )) + num_sectors = (2ULL <<32 ) -2 ;md_super_write (rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, rdev->sb_page);md_super_wait (rdev->mddev);
Signature · 1 line
1.7.12.1
PATCH 14/77 md: Don't truncate size at 4TB for RAID0 and Linear
In reply to Paul GortmakerFrom: NeilBrown <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 667a5313ecd7308d79629c0738b0db588b0b0a4e upstream.
commit 27a7b260f71439c40546b43588448faac01adb93
md: Fix handling for devices from 2TB to 4TB in 0.90 metadata.
changed 0.90 metadata handling to truncated size to 4TB as that is all that 0.90 can record.
However for RAID0 and Linear, 0.90 doesn't need to record the size, so this truncation is not needed and causes working arrays to become too small.
So avoid the truncation for RAID0 and Linear
This bug was introduced in 3.1 and is suitable for any stable kernels from then onwards.
As the offending commit was tagged for 'stable', any stable kernel that it was applied to should also get this patch. That includes at least 2.6.32, 2.6.33 and 3.0. (Thanks to Ben Hutchings for providing that list).
--- drivers/md/md.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/md/md.c +6 -3
@@ -985,8 +985,11 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version ret =0 ; } rdev->sectors = rdev->sb_start; -/* Limit to 4TB as metadata cannot record more than that */ -if (rdev->sectors >= (2ULL <<32 )) +/* Limit to 4TB as metadata cannot record more than that. +* (not needed for Linear and RAID0 as metadata doesn't +* record this size) +*/ +if (rdev->sectors >= (2ULL <<32 ) && sb->level >=1 ) rdev->sectors = (2ULL <<32 ) -2 ;if (rdev->sectors < ((sector_t )sb->size) *2 && sb->level >=1 )
@@ -1266,7 +1269,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors)/* Limit to 4TB as metadata cannot record more than that. * 4TB == 2^32 KB, or 2*2^32 sectors. */ -if (num_sectors >= (2ULL <<32 )) +if (num_sectors >= (2ULL <<32 ) && rdev->mddev->level >=1 ) num_sectors = (2ULL <<32 ) -2 ;md_super_write (rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, rdev->sb_page);
Signature · 1 line
1.7.12.1
PATCH 15/77 genalloc: stop crashing the system when destroying a pool
In reply to Paul GortmakerFrom: Thadeu Lima de Souza Cascardo <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit eedce141cd2dad8d0cefc5468ef41898949a7031 upstream.
The genalloc code uses the bitmap API from include/linux/bitmap.h and lib/bitmap.c, which is based on long values. Both bitmap_set from lib/bitmap.c and bitmap_set_ll, which is the lockless version from genalloc.c, use BITMAP_LAST_WORD_MASK to set the first bits in a long in the bitmap.
That one uses (1 << bits) - 1, 0b111, if you are setting the first three bits. This means that the API counts from the least significant bits (LSB from now on) to the MSB. The LSB in the first long is bit 0, then. The same works for the lookup functions.
The genalloc code uses longs for the bitmap, as it should. In include/linux/genalloc.h, struct gen_pool_chunk has unsigned long bits[0] as its last member. When allocating the struct, genalloc should reserve enough space for the bitmap. This should be a proper number of longs that can fit the amount of bits in the bitmap.
However, genalloc allocates an integer number of bytes that fit the amount of bits, but may not be an integer amount of longs. 9 bytes, for example, could be allocated for 70 bits.
This is a problem in itself if the Least Significat Bit in a long is in the byte with the largest address, which happens in Big Endian machines. This means genalloc is not allocating the byte in which it will try to set or check for a bit.
This may end up in memory corruption, where genalloc will try to set the bits it has not allocated. In fact, genalloc may not set these bits because it may find them already set, because they were not zeroed since they were not allocated. And that's what causes a BUG when gen_pool_destroy is called and check for any set bits.
What really happens is that genalloc uses kmalloc_node with __GFP_ZERO on gen_pool_add_virt. With SLAB and SLUB, this means the whole slab will be cleared, not only the requested bytes. Since struct gen_pool_chunk has a size that is a multiple of 8, and slab sizes are multiples of 8, we get lucky and allocate and clear the right amount of bytes.
Hower, this is not the case with SLOB or with older code that did memset after allocating instead of using __GFP_ZERO.
So, a simple module as this (running 3.6.0), will cause a crash when rmmod'ed.
[root@phantom-lp2 foo]# cat foo.c
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/genalloc.h>
MODULE_LICENSE("GPL");
MODULE_VERSION("0.1"); static struct gen_pool *foo_pool;
static __init int foo_init(void)
{
int ret;
foo_pool = gen_pool_create(10, -1);
if (!foo_pool)
return -ENOMEM;
ret = gen_pool_add(foo_pool, 0xa0000000, 32 << 10, -1);
if (ret) {
gen_pool_destroy(foo_pool);
return ret;
}
return 0;
}
static __exit void foo_exit(void)
{
gen_pool_destroy(foo_pool);
} module_init(foo_init);
module_exit(foo_exit);
[root@phantom-lp2 foo]# zcat /proc/config.gz | grep SLOB CONFIG_SLOB=y
[root@phantom-lp2 foo]# insmod ./foo.ko [root@phantom-lp2 foo]# rmmod foo
------------[ cut here ]------------
kernel BUG at lib/genalloc.c:243!
cpu 0x4: Vector: 700 (Program Check) at [c0000000bb0e7960]
pc: c0000000003cb50c: .gen_pool_destroy+0xac/0x110
lr: c0000000003cb4fc: .gen_pool_destroy+0x9c/0x110
sp: c0000000bb0e7be0
msr: 8000000000029032
current = 0xc0000000bb0e0000
paca = 0xc000000006d30e00 softe: 0 irq_happened: 0x01
pid = 13044, comm = rmmod
kernel BUG at lib/genalloc.c:243!
[c0000000bb0e7ca0] d000000004b00020 .foo_exit+0x20/0x38 [foo]
[c0000000bb0e7d20] c0000000000dff98 .SyS_delete_module+0x1a8/0x290
[c0000000bb0e7e30] c0000000000097d4 syscall_exit+0x0/0x94
--- Exception: c00 (System Call) at 000000800753d1a0
SP (fffd0b0e640) is in userspace--- lib/genalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/genalloc.c +1 -1
@@ -54,7 +54,7 @@ int gen_pool_add(struct gen_pool *pool, unsigned long addr, size_t size,struct gen_pool_chunk *chunk;int nbits = size >> pool->min_alloc_order;int nbytes =sizeof (struct gen_pool_chunk ) + - (nbits +BITS_PER_BYTE -1 ) /BITS_PER_BYTE ; +BITS_TO_LONGS (nbits) *sizeof (long ); chunk =kmalloc_node (nbytes,GFP_KERNEL | __GFP_ZERO, nid);if (unlikely (chunk ==NULL ))
Signature · 1 line
1.7.12.1
PATCH 16/77 inotify: stop kernel memory leak on file creation failure
In reply to Paul GortmakerFrom: Eric Paris <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit a2ae4cc9a16e211c8a128ba10d22a85431f093ab upstream.
If inotify_init is unable to allocate a new file for the new inotify group we leak the new group. This patch drops the reference on the group on file allocation failure.
--- fs/notify/inotify/inotify_user.c | 1 + 1 file changed, 1 insertion(+)
fs/notify/inotify/inotify_user.c +1 -0
@@ -674,6 +674,7 @@ SYSCALL_DEFINE1(inotify_init1, int, flags)if (ret >=0 )return ret; +fsnotify_put_group (group);atomic_dec (&user->inotify_devs); out_free_uid:free_uid (user);
Signature · 1 line
1.7.12.1
PATCH 17/77 xfs: validate acl count
In reply to Paul GortmakerFrom: Christoph Hellwig <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit fa8b18edd752a8b4e9d1ee2cd615b82c93cf8bba upstream.
This prevents in-memory corruption and possible panics if the on-disk ACL is badly corrupted.
--- fs/xfs/linux-2.6/xfs_acl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/xfs/linux-2.6/xfs_acl.c +2 -0
@@ -42,6 +42,8 @@ xfs_acl_from_disk(struct xfs_acl *aclp)int count, i; count =be32_to_cpu (aclp->acl_cnt); +if (count >XFS_ACL_MAX_ENTRIES ) +return ERR_PTR (-EFSCORRUPTED ); acl =posix_acl_alloc (count,GFP_KERNEL );if (!acl)
Signature · 1 line
1.7.12.1
PATCH 18/77 xfs: fix acl count validation in xfs_acl_from_disk()
In reply to Paul GortmakerFrom: Xi Wang <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 093019cf1b18dd31b2c3b77acce4e000e2cbc9ce upstream.
Commit fa8b18ed didn't prevent the integer overflow and possible memory corruption. "count" can go negative and bypass the check.
--- fs/xfs/linux-2.6/xfs_acl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/linux-2.6/xfs_acl.c +1 -1
@@ -39,7 +39,7 @@ xfs_acl_from_disk(struct xfs_acl *aclp)struct posix_acl_entry *acl_e;struct posix_acl *acl;struct xfs_acl_entry *ace; -int count, i; +unsigned int count, i; count =be32_to_cpu (aclp->acl_cnt);if (count >XFS_ACL_MAX_ENTRIES )
Signature · 1 line
1.7.12.1
PATCH 19/77 x86, ioapic: initialize nr_ioapic_registers early in mp_register_ioapic()
In reply to Paul GortmakerFrom: Suresh Siddha <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------Lin Bao reported that one of the HP platforms failed to boot 2.6.32 kernel, when the BIOS enabled interrupt-remapping and x2apic before handing over the control to the Linux kernel.
During boot, Linux kernel masks all the interrupt sources (8259, IO-APIC RTE's), setup the interrupt-remapping hardware with the OS controlled table and unmasks the 8259 interrupts but not the IO-APIC RTE's (as the newly setup interrupt-remapping table and the IO-APIC RTE's are not yet programmed by the kernel).
Shortly after this, IO-APIC RTE's and the interrupt-remapping table entries are programmed based on the ACPI tables etc. So the expectation is that any interrupt during this window will be dropped and not see the intermediate configuration.
In the reported problematic case, BIOS has configured the IO-APIC in virtual wire-B mode. Between the window of the kernel setting up new interrupt-remapping table and the IO-APIC RTE's are properly configured, an interrupt gets routed by the IO-APIC RTE (setup by the virtual wire-B configuration) and sees the empty interrupt-remapping table entry, resulting in vt-d fault causing the platform to generate NMI. And the OS panics on this unexpected NMI.
This problem doesn't happen with more recent kernels and closer look at the 2.6.32 kernel shows that the code which masks the IO-APIC RTE's is not working as expected as the nr_ioapic_registers for each IO-APIC is not yet initialized at this point. In the later kernels we initialize nr_ioapic_registers much before and everything works as expected.
For 2.6.[32..34] kernels, fix this issue by initializing nr_ioapic_registers early in mp_register_ioapic()
[ Relevant upstream commit info:
commit 7716a5c4ff5f1f3dc5e9edcab125cbf7fceef0af
Author: Eric W. Biederman <[email protected]>
Date: Tue Mar 30 01:07:12 2010 -0700
x86, ioapic: Move nr_ioapic_registers calculation to mp_register_ioapic.
As the upstream commit depends on quite a few prior commits and some followup fixes in the mainline, we just picked the smallest relevant hunk for fixing the issue at hand. Problematic platform uses ACPI for IO-APIC, VT-d enumeration etc and this hunk only touches the ACPI based platforms.
nr_ioapic_reigsters initialization in enable_IO_APIC() is still retained, so that other configurations like legacy MPS table based enumeration etc works with no change.
]
--- arch/x86/kernel/apic/io_apic.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/x86/kernel/apic/io_apic.c +7 -2
@@ -4294,6 +4294,7 @@ static int bad_ioapic(unsigned long address)void __init mp_register_ioapic (int id,u32 address,u32 gsi_base) {int idx =0 ; +int entries;if (bad_ioapic (address))return ;
@@ -4312,10 +4313,14 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)* Build basic GSI lookup table to facilitate gsi->io_apic lookups * and to prevent reprogramming of IOAPIC pins (PCI GSIs). */ + entries =io_apic_get_redir_entries (idx); mp_gsi_routing[idx].gsi_base = gsi_base; - mp_gsi_routing[idx].gsi_end = gsi_base + -io_apic_get_redir_entries (idx); + mp_gsi_routing[idx].gsi_end = gsi_base + entries; +/* +* The number of IO-APIC IRQ registers (== #pins): +*/ + nr_ioapic_registers[idx] = entries +1 ; printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " "GSI %d-%d\n", idx, mp_ioapics[idx].apicid, mp_ioapics[idx].apicver, mp_ioapics[idx].apicaddr,
Signature · 1 line
1.7.12.1
PATCH 20/77 i2c-algo-bit: Generate correct i2c address sequence for 10-bit target
In reply to Paul GortmakerFrom: "Jeffrey (Sheng-Hui) Chu" <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit cc6bcf7d2ec2234e7b41770185e4dc826390185e upstream.
The wrong bits were put on the wire, fix that.
This fixes kernel bug #42562.
--- drivers/i2c/algos/i2c-algo-bit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/algos/i2c-algo-bit.c +2 -2
@@ -470,7 +470,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)if (flags &I2C_M_TEN ) {/* a ten bit address */ - addr =0xf0 | ((msg->addr >>7 ) &0x03 ); + addr =0xf0 | ((msg->addr >>7 ) &0x06 );bit_dbg (2 , &i2c_adap->dev,"addr0: %d\n" , addr);/* try extended address code...*/ ret =try_address (i2c_adap, addr, retries);
@@ -480,7 +480,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)return -EREMOTEIO ; }/* the remaining 8 bit address */ - ret =i2c_outb (i2c_adap, msg->addr &0x7f ); + ret =i2c_outb (i2c_adap, msg->addr &0xff );if ((ret !=1 ) && !nak_ok) {/* the chip did not ack / xmission error occurred */ dev_err (&i2c_adap->dev,"died at 2nd address code\n" );
Signature · 1 line
1.7.12.1
PATCH 21/77 eCryptfs: Extend array bounds for all filename chars
In reply to Paul GortmakerFrom: Tyler Hicks <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 0f751e641a71157aa584c2a2e22fda52b52b8a56 upstream.
Quoted 1 line
From mhalcrow's original commit message:
Characters with ASCII values greater than the size of filename_rev_map[] are valid filename characters. ecryptfs_decode_from_filename() will access kernel memory beyond that array, and ecryptfs_parse_tag_70_packet() will then decrypt those characters. The attacker, using the FNEK of the crafted file, can then re-encrypt the characters to reveal the kernel memory past the end of the filename_rev_map[] array. I expect low security impact since this array is statically allocated in the text area, and the amount of memory past the array that is accessible is limited by the largest possible ASCII filename character.
This patch solves the issue reported by mhalcrow but with an implementation suggested by Linus to simply extend the length of filename_rev_map[] to 256. Characters greater than 0x7A are mapped to 0x00, which is how invalid characters less than 0x7A were previously being handled.
--- fs/ecryptfs/crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ecryptfs/crypto.c +2 -2
@@ -1934,7 +1934,7 @@ static unsigned char *portable_filename_chars = ("-.0123456789ABCD"/* We could either offset on every reverse map or just pad some 0x00's * at the front here */ -static const unsigned char filename_rev_map[] = { +static const unsigned char filename_rev_map[256 ] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 7 */ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 15 */ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 23 */
@@ -1950,7 +1950,7 @@ static const unsigned char filename_rev_map[] = {0x00 ,0x26 ,0x27 ,0x28 ,0x29 ,0x2A ,0x2B ,0x2C ,/* 103 */ 0x2D ,0x2E ,0x2F ,0x30 ,0x31 ,0x32 ,0x33 ,0x34 ,/* 111 */ 0x35 ,0x36 ,0x37 ,0x38 ,0x39 ,0x3A ,0x3B ,0x3C ,/* 119 */ -0x3D ,0x3E ,0x3F +0x3D ,0x3E ,0x3F /* 123 - 255 initialized to 0x00 */ };/**
Signature · 1 line
1.7.12.1
PATCH 22/77 PCI hotplug: shpchp: don't blindly claim non-AMD 0x7450 device IDs
In reply to Paul GortmakerFrom: Bjorn Helgaas <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 4cac2eb158c6da0c761689345c6cc5df788a6292 upstream.
Previously we claimed device ID 0x7450, regardless of the vendor, which is clearly wrong. Now we'll claim that device ID only for AMD.
I suspect this was just a typo in the original code, but it's possible this change will break shpchp on non-7450 AMD bridges. If so, we'll have to fix them as we find them.
Reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638863
--- drivers/pci/hotplug/shpchp_core.c | 4 ++-- drivers/pci/hotplug/shpchp_hpc.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/pci/hotplug/shpchp_core.c +2 -2
@@ -278,8 +278,8 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)static int is_shpc_capable (struct pci_dev *dev) { -if ((dev->vendor ==PCI_VENDOR_ID_AMD ) || (dev->device == -PCI_DEVICE_ID_AMD_GOLAM_7450 )) +if (dev->vendor ==PCI_VENDOR_ID_AMD && + dev->device ==PCI_DEVICE_ID_AMD_GOLAM_7450 )return 1 ;if (!pci_find_capability (dev,PCI_CAP_ID_SHPC ))return 0 ;
drivers/pci/hotplug/shpchp_hpc.c +2 -2
@@ -953,8 +953,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ctrl->pci_dev = pdev;/* pci_dev of the P2P bridge */ ctrl_dbg (ctrl,"Hotplug Controller:\n" ); -if ((pdev->vendor ==PCI_VENDOR_ID_AMD ) || (pdev->device == -PCI_DEVICE_ID_AMD_GOLAM_7450 )) { +if (pdev->vendor ==PCI_VENDOR_ID_AMD && + pdev->device ==PCI_DEVICE_ID_AMD_GOLAM_7450 ) {/* amd shpc driver doesn't use Base Offset; assume 0 */ ctrl->mmio_base =pci_resource_start (pdev,0 ); ctrl->mmio_size =pci_resource_len (pdev,0 );
Signature · 1 line
1.7.12.1
PATCH 23/77 ARM: 7161/1: errata: no automatic store buffer drain
In reply to Paul GortmakerFrom: Will Deacon <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 11ed0ba1754841316d4095478944300acf19acc3 upstream.
This patch implements a workaround for PL310 erratum 769419. On revisions of the PL310 prior to r3p2, the Store Buffer does not automatically drain. This can cause normal, non-cacheable writes to be retained when the memory system is idle, leading to suboptimal I/O performance for drivers using coherent DMA.
This patch adds an optional wmb() call to the cpu_idle loop. On systems with an outer cache, this causes an explicit flush of the store buffer.
--- arch/arm/Kconfig | 12 ++++++++++++ arch/arm/kernel/process.c | 3 +++ 2 files changed, 15 insertions(+)
arch/arm/Kconfig +12 -0
@@ -1380,6 +1380,18 @@ config UACCESS_WITH_MEMCPY However, if the CPU data cache is using a write-allocate mode, this option is unlikely to provide any performance gain. +config PL310_ERRATA_769419 + bool "PL310 errata: no automatic Store Buffer drain" + depends on CACHE_L2X0 + help + On revisions of the PL310 prior to r3p2, the Store Buffer does + not automatically drain. This can cause normal, non-cacheable + writes to be retained when the memory system is idle, leading + to suboptimal I/O performance for drivers using coherent DMA. + This option adds a write barrier to the cpu_idle loop so that, + on systems with an outer cache, the store buffer is drained + explicitly. + endmenu menu "Boot options"
arch/arm/kernel/process.c +3 -0
@@ -155,6 +155,9 @@ void cpu_idle(void)#endif local_irq_disable (); +#ifdef CONFIG_PL310_ERRATA_769419 +wmb (); +#endif if (hlt_counter) {local_irq_enable ();cpu_relax ();
Signature · 1 line
1.7.12.1
PATCH 24/77 ALSA: lx6464es - fix device communication via command bus
In reply to Paul GortmakerFrom: Tim Blechmann <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit a29878553a9a7b4c06f93c7e383527cf014d4ceb upstream.
commit 6175ddf06b6172046a329e3abfd9c901a43efd2e optimized the mem*io functions that have been used to send commands to the device. these optimizations somehow corrupted the communication with the lx6464es, that resulted the device to be unusable with kernels after 2.6.33.
this patch emulates the memcpy_*_io functions via a loop to avoid these problems.
LKML-Reference: <[email protected]>
--- sound/pci/lx6464es/lx_core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
sound/pci/lx6464es/lx_core.c +12 -4
@@ -80,8 +80,12 @@ unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port)void lx_dsp_reg_readbuf (struct lx6464es *chip,int port,u32 *data,u32 len) { -void __iomem *address =lx_dsp_register (chip, port); -memcpy_fromio (data, address, len*sizeof (u32)); +u32 __iomem *address =lx_dsp_register (chip, port); +int i; + +/* we cannot use memcpy_fromio */ +for (i =0 ; i != len; ++i) + data[i] =ioread32 (address + i); }
@@ -94,8 +98,12 @@ void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data)void lx_dsp_reg_writebuf (struct lx6464es *chip,int port,const u32 *data,u32 len) { -void __iomem *address =lx_dsp_register (chip, port); -memcpy_toio (address, data, len*sizeof (u32)); +u32 __iomem *address =lx_dsp_register (chip, port); +int i; + +/* we cannot use memcpy_to */ +for (i =0 ; i != len; ++i) +iowrite32 (data[i], address + i); }
Signature · 1 line
1.7.12.1
PATCH 25/77 SUNRPC: Ensure we return EAGAIN in xs_nospace if congestion is cleared
In reply to Paul GortmakerFrom: Trond Myklebust <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 24ca9a847791fd53d9b217330b15f3c285827a18 upstream.
By returning '0' instead of 'EAGAIN' when the tests in xs_nospace() fail to find evidence of socket congestion, we are making the RPC engine believe that the message was incorrectly sent and so it disconnects the socket instead of just retrying.
The bug appears to have been introduced by commit 5e3771ce2d6a69e10fcc870cdf226d121d868491 (SUNRPC: Ensure that xs_nospace return values are propagated).
--- net/sunrpc/xprtsock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/sunrpc/xprtsock.c +1 -2
@@ -478,7 +478,7 @@ static int xs_nospace(struct rpc_task *task)struct rpc_rqst *req = task->tk_rqstp;struct rpc_xprt *xprt = req->rq_xprt; struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); -int ret =0 ; +int ret = -EAGAIN ; dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", task->tk_pid, req->rq_slen - req->rq_bytes_sent,
@@ -490,7 +490,6 @@ static int xs_nospace(struct rpc_task *task)/* Don't race with disconnect */ if (xprt_connected (xprt)) {if (test_bit (SOCK_ASYNC_NOSPACE , &transport->sock->flags)) { - ret = -EAGAIN ;/* * Notify TCP that we're limited by the application * window size
Signature · 1 line
1.7.12.1
PATCH 26/77 timekeeping: add arch_offset hook to ktime_get functions
In reply to Paul GortmakerFrom: Hector Palacios <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit d004e024058a0eaca097513ce62cbcf978913e0a upstream.
ktime_get and ktime_get_ts were calling timekeeping_get_ns() but later they were not calling arch_gettimeoffset() so architectures using this mechanism returned 0 ns when calling these functions.
This happened for example when running Busybox's ping which calls syscall(__NR_clock_gettime, CLOCK_MONOTONIC, ts) which eventually calls ktime_get. As a result the returned ping travel time was zero.
--- kernel/time/timekeeping.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/time/timekeeping.c +4 -0
@@ -277,6 +277,8 @@ ktime_t ktime_get(void) secs = xtime.tv_sec + wall_to_monotonic.tv_sec; nsecs = xtime.tv_nsec + wall_to_monotonic.tv_nsec; nsecs +=timekeeping_get_ns (); +/* If arch requires, add in gettimeoffset() */ + nsecs +=arch_gettimeoffset (); }while (read_seqretry (&xtime_lock, seq));/*
@@ -308,6 +310,8 @@ void ktime_get_ts(struct timespec *ts) *ts = xtime; tomono = wall_to_monotonic; nsecs =timekeeping_get_ns (); +/* If arch requires, add in gettimeoffset() */ + nsecs +=arch_gettimeoffset (); }while (read_seqretry (&xtime_lock, seq));
Signature · 1 line
1.7.12.1
PATCH 27/77 p54spi: Add missing spin_lock_init
In reply to Paul GortmakerFrom: Michael Büsch <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 32d3a3922d617a5a685a5e2d24b20d0e88f192a9 upstream.
The tx_lock is not initialized properly. Add spin_lock_init().
--- drivers/net/wireless/p54/p54spi.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/p54/p54spi.c +1 -0
@@ -651,6 +651,7 @@ static int __devinit p54spi_probe(struct spi_device *spi)init_completion (&priv->fw_comp);INIT_LIST_HEAD (&priv->tx_pending);mutex_init (&priv->mutex); +spin_lock_init (&priv->tx_lock);SET_IEEE80211_DEV (hw, &spi->dev); priv->common.open = p54spi_op_start; priv->common.stop = p54spi_op_stop;
Signature · 1 line
1.7.12.1
PATCH 28/77 p54spi: Fix workqueue deadlock
In reply to Paul GortmakerFrom: Michael Büsch <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 2d1618170eb493d18f66f2ac03775409a6fb97c6 upstream.
priv->work must not be synced while priv->mutex is locked, because the mutex is taken in the work handler.
Move cancel_work_sync down to after the device shutdown code. This is safe, because the work handler checks fw_state and bails out early in case of a race.
--- drivers/net/wireless/p54/p54spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/p54/p54spi.c +2 -2
@@ -582,8 +582,6 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)WARN_ON (priv->fw_state !=FW_STATE_READY ); -cancel_work_sync (&priv->work); -p54spi_power_off (priv);spin_lock_irqsave (&priv->tx_lock, flags);INIT_LIST_HEAD (&priv->tx_pending);
@@ -591,6 +589,8 @@ static void p54spi_op_stop(struct ieee80211_hw *dev) priv->fw_state =FW_STATE_OFF ;mutex_unlock (&priv->mutex); + +cancel_work_sync (&priv->work); }static int __devinit p54spi_probe (struct spi_device *spi)
Signature · 1 line
1.7.12.1
PATCH 29/77 nl80211: fix MAC address validation
In reply to Paul GortmakerFrom: Eliad Peller <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit e007b857e88097c96c45620bf3b04a4e309053d1 upstream.
MAC addresses have a fixed length. The current policy allows passing < ETH_ALEN bytes, which might result in reading beyond the buffer.
--- net/wireless/nl80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/wireless/nl80211.c +2 -2
@@ -76,8 +76,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, - [NL80211_ATTR_MAC] = { .type = NLA_BINARY, .len = ETH_ALEN }, - [NL80211_ATTR_PREV_BSSID] = { .type = NLA_BINARY, .len = ETH_ALEN }, + [NL80211_ATTR_MAC] = { .len = ETH_ALEN }, + [NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN }, [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY,
Signature · 1 line
1.7.12.1
PATCH 30/77 staging: usbip: bugfix for deadlock
In reply to Paul GortmakerFrom: Bart Westgeest <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 438957f8d4a84daa7fa5be6978ad5897a2e9e5e5 upstream.
Interrupts must be disabled prior to calling usb_hcd_unlink_urb_from_ep. If interrupts are not disabled, it can potentially lead to a deadlock. The deadlock is readily reproduceable on a slower (ARM based) device such as the TI Pandaboard.
--- drivers/staging/usbip/vhci_rx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/usbip/vhci_rx.c +6 -4
@@ -69,6 +69,7 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, {struct usbip_device *ud = &vdev->ud;struct urb *urb; +unsigned long flags;spin_lock (&vdev->priv_lock);
@@ -109,9 +110,9 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,usbip_dbg_vhci_rx ("now giveback urb %p\n" , urb); -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags);usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, urb->status);
@@ -152,6 +153,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, {struct vhci_unlink *unlink;struct urb *urb; +unsigned long flags;usbip_dump_header (pdu);
@@ -183,9 +185,9 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, urb->status = pdu->u.ret_unlink.status;usbip_uinfo ("%d\n" , urb->status); -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags);usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, urb->status);
Signature · 1 line
1.7.12.1
PATCH 31/77 staging: comedi: fix oops for USB DAQ devices.
In reply to Paul GortmakerFrom: Bernd Porr <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 3ffab428f40849ed5f21bcfd7285bdef7902f9ca upstream.
This fixes kernel oops when an USB DAQ device is plugged out while it's communicating with the userspace software.
--- drivers/staging/comedi/comedi_fops.c | 71 +++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 18 deletions(-)
drivers/staging/comedi/comedi_fops.c +53 -18
@@ -1391,9 +1391,6 @@ static struct vm_operations_struct comedi_vm_ops = {static int comedi_mmap (struct file *file,struct vm_area_struct *vma) {const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device;struct comedi_async *async =NULL ;unsigned long start = vma->vm_start;unsigned long size;
@@ -1401,6 +1398,15 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)int i;int retval;struct comedi_subdevice *s; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + + dev_file_info =comedi_get_device_file_info (minor); +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;mutex_lock (&dev->mutex);if (!dev->attached) {
@@ -1467,11 +1473,17 @@ static unsigned int comedi_poll(struct file *file, poll_table * wait) {unsigned int mask =0 ;const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device;struct comedi_subdevice *read_subdev;struct comedi_subdevice *write_subdev; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); + +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;mutex_lock (&dev->mutex);if (!dev->attached) {
@@ -1517,9 +1529,15 @@ static ssize_t comedi_write(struct file *file, const char *buf, size_t nbytes,int n, m, count =0 , retval =0 ;DECLARE_WAITQUEUE (wait, current);const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); + +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;if (!dev->attached) {DPRINTK ("no driver configured on comedi%i\n" , dev->minor);
@@ -1619,9 +1637,15 @@ static ssize_t comedi_read(struct file *file, char *buf, size_t nbytes,int n, m, count =0 , retval =0 ;DECLARE_WAITQUEUE (wait, current);const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); + +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;if (!dev->attached) {DPRINTK ("no driver configured on comedi%i\n" , dev->minor);
@@ -1814,11 +1838,17 @@ ok:static int comedi_close (struct inode *inode,struct file *file) {const unsigned minor =iminor (inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device;struct comedi_subdevice *s =NULL ;int i; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); + +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;mutex_lock (&dev->mutex);
@@ -1852,10 +1882,15 @@ static int comedi_close(struct inode *inode, struct file *file)static int comedi_fasync (int fd,struct file *file,int on) {const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device; +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;return fasync_helper (fd, file, on, &dev->async_queue); }
Signature · 1 line
1.7.12.1
PATCH 32/77 Staging: comedi: fix signal handling in read and write
In reply to Paul GortmakerFrom: Federico Vaga <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 6a9ce6b654e491981f6ef7e214cbd4f63e033848 upstream.
After sleeping on a wait queue, signal_pending(current) should be checked (not before sleeping).
--- drivers/staging/comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/comedi/comedi_fops.c +2 -2
@@ -1594,11 +1594,11 @@ static ssize_t comedi_write(struct file *file, const char *buf, size_t nbytes, retval = -EAGAIN ;break ; } +schedule ();if (signal_pending (current)) { retval = -ERESTARTSYS ;break ; } -schedule ();if (!s->busy)break ;if (s->busy != file) {
@@ -1701,11 +1701,11 @@ static ssize_t comedi_read(struct file *file, char *buf, size_t nbytes, retval = -EAGAIN ;break ; } +schedule ();if (signal_pending (current)) { retval = -ERESTARTSYS ;break ; } -schedule ();if (!s->busy) { retval =0 ;break ;
Signature · 1 line
1.7.12.1
PATCH 33/77 USB: whci-hcd: fix endian conversion in qset_clear()
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 8746c83d538cab273d335acb2be226d096f4a5af upstream.
qset->qh.link is an __le64 field and we should be using cpu_to_le64() to fill it.
--- drivers/usb/host/whci/qset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/whci/qset.c +1 -1
@@ -124,7 +124,7 @@ void qset_clear(struct whc *whc, struct whc_qset *qset) { qset->td_start = qset->td_end = qset->ntds =0 ; - qset->qh.link =cpu_to_le32 (QH_LINK_NTDS (8 ) |QH_LINK_T ); + qset->qh.link =cpu_to_le64 (QH_LINK_NTDS (8 ) |QH_LINK_T ); qset->qh.status = qset->qh.status &QH_STATUS_SEQ_MASK ; qset->qh.err_count =0 ; qset->qh.scratch[0 ] =0 ;
Signature · 1 line
1.7.12.1
PATCH 34/77 usb: ftdi_sio: add PID for Propox ISPcable III
In reply to Paul GortmakerFrom: Marcin Kościelnicki <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 307369b0ca06b27b511b61714e335ddfccf19c4f upstream.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 1 + 2 files changed, 2 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -739,6 +739,7 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID),
drivers/usb/serial/ftdi_sio_ids.h +1 -0
@@ -111,6 +111,7 @@/* Propox devices */ #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738 +#define FTDI_PROPOX_ISPCABLEIII_PID 0xD739/* Lenz LI-USB Computer Interface. */ #define FTDI_LENZ_LIUSB_PID 0xD780
Signature · 1 line
1.7.12.1
PATCH 35/77 usb: option: add SIMCom SIM5218
In reply to Paul GortmakerFrom: Veli-Pekka Peltola <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit ec0cd94d881ca89cc9fb61d00d0f4b2b52e605b3 upstream.
Tested with SIM5218EVB-KIT evaluation kit.
--- drivers/usb/serial/option.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/option.c +1 -0
@@ -612,6 +612,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
Signature · 1 line
1.7.12.1
PATCH 36/77 USB: usb-storage: unusual_devs entry for Kingston DT 101 G2
In reply to Paul GortmakerFrom: Qinglin Ye <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit cec28a5428793b6bc64e56687fb239759d6da74e upstream.
Kingston DT 101 G2 replies a wrong tag while transporting, add an unusal_devs entry to ignore the tag validation.
--- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -1852,6 +1852,13 @@ UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110, US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_IGNORE_RESIDUE ), +/* Reported by Qinglin Ye <[email protected]> */ +UNUSUAL_DEV (0x13fe ,0x3600 ,0x0100 ,0x0100 , +"Kingston" , +"DT 101 G2" , +US_SC_DEVICE ,US_PR_DEVICE ,NULL , +US_FL_BULK_IGNORE_TAG ), +/* Reported by Francesco Foresti <[email protected]> */ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, "Super Top",
Signature · 1 line
1.7.12.1
PATCH 37/77 Silencing 'killing requests for dead queue'
In reply to Paul GortmakerFrom: Hannes Reinecke <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 745718132c3c7cac98a622b610e239dcd5217f71 upstream.
When we tear down a device we try to flush all outstanding commands in scsi_free_queue(). However the check in scsi_request_fn() is imperfect as it only signals that we _might start_ aborting commands, not that we've actually aborted some.
So move the printk inside the scsi_kill_request function, this will also give us a hint about which commands are aborted.
--- drivers/scsi/scsi_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +2 -1
@@ -1383,6 +1383,8 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)BUG (); } +scmd_printk (KERN_INFO , cmd,"killing request\n" ); + sdev = cmd->device; starget =scsi_target (sdev); shost = sdev->host;
@@ -1469,7 +1471,6 @@ static void scsi_request_fn(struct request_queue *q)struct request *req;if (!sdev) { -printk ("scsi: killing requests for dead queue\n" );while ((req =blk_peek_request (q)) !=NULL )scsi_kill_request (req, q);return ;
Signature · 1 line
1.7.12.1
PATCH 38/77 sched, x86: Avoid unnecessary overflow in sched_clock
In reply to Paul GortmakerFrom: Salman Qazi <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 4cecf6d401a01d054afc1e5f605bcbfe553cb9b9 upstream.
(Added the missing signed-off-by line)
In hundreds of days, the __cycles_2_ns calculation in sched_clock has an overflow. cyc * per_cpu(cyc2ns, cpu) exceeds 64 bits, causing the final value to become zero. We can solve this without losing any precision.
We can decompose TSC into quotient and remainder of division by the scale factor, and then use this to convert TSC into nanoseconds.
--- arch/x86/include/asm/timer.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
arch/x86/include/asm/timer.h +22 -1
@@ -38,6 +38,22 @@ extern int no_timer_check;* ([email protected]) * * [email protected] "math is hard, lets go shopping!" +* +* In: +* +* ns = cycles * cyc2ns_scale / SC +* +* Although we may still have enough bits to store the value of ns, +* in some cases, we may not have enough bits to store cycles * cyc2ns_scale, +* leading to an incorrect result. +* +* To avoid this, we can decompose 'cycles' into quotient and remainder +* of division by SC. Then, +* +* ns = (quot * SC + rem) * cyc2ns_scale / SC +* = quot * cyc2ns_scale + (rem * cyc2ns_scale) / SC +* +* - [email protected] */ DECLARE_PER_CPU(unsigned long, cyc2ns);
@@ -47,9 +63,14 @@ DECLARE_PER_CPU(unsigned long long, cyc2ns_offset);static inline unsigned long long __cycles_2_ns (unsigned long long cyc) { +unsigned long long quot; +unsigned long long rem;int cpu =smp_processor_id ();unsigned long long ns =per_cpu (cyc2ns_offset, cpu); - ns += cyc *per_cpu (cyc2ns, cpu) >>CYC2NS_SCALE_FACTOR ; + quot = (cyc >>CYC2NS_SCALE_FACTOR ); + rem = cyc & ((1ULL <<CYC2NS_SCALE_FACTOR ) -1 ); + ns += quot *per_cpu (cyc2ns, cpu) + + ((rem *per_cpu (cyc2ns, cpu)) >>CYC2NS_SCALE_FACTOR );return ns; }
Signature · 1 line
1.7.12.1
PATCH 39/77 x86/mpparse: Account for bus types other than ISA and PCI
In reply to Paul GortmakerFrom: Bjorn Helgaas <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 9e6866686bdf2dcf3aeb0838076237ede532dcc8 upstream.
In commit f8924e770e04 ("x86: unify mp_bus_info"), the 32-bit and 64-bit versions of MP_bus_info were rearranged to match each other better. Unfortunately it introduced a regression: prior to that change we used to always set the mp_bus_not_pci bit, then clear it if we found a PCI bus. After it, we set mp_bus_not_pci for ISA buses, clear it for PCI buses, and leave it alone otherwise.
In the cases of ISA and PCI, there's not much difference. But ISA is not the only non-PCI bus, so it's better to always set mp_bus_not_pci and clear it only for PCI.
Without this change, Dan's Dell PowerEdge 4200 panics on boot with a log indicating interrupt routing trouble unless the "noapic" option is supplied. With this change, the machine boots reliably without "noapic".
Fixes http://bugs.debian.org/586494
--- arch/x86/kernel/mpparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/mpparse.c +1 -1
@@ -94,8 +94,8 @@ static void __init MP_bus_info(struct mpc_bus *m) }#endif +set_bit (m->busid, mp_bus_not_pci);if (strncmp (str,BUSTYPE_ISA ,sizeof (BUSTYPE_ISA ) -1 ) ==0 ) { -set_bit (m->busid, mp_bus_not_pci);#if defined(CONFIG_EISA ) || defined(CONFIG_MCA ) mp_bus_id_to_type[m->busid] =MP_BUS_ISA ;#endif
Signature · 1 line
1.7.12.1
PATCH 40/77 oprofile, x86: Fix crash when unloading module (nmi timer mode)
In reply to Paul GortmakerFrom: Robert Richter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 97f7f8189fe54e3cfe324ef9ad35064f3d2d3bff upstream.
If oprofile uses the nmi timer interrupt there is a crash while unloading the module. The bug can be triggered with oprofile build as module and kernel parameter nolapic set. This patch fixes this.
oprofile: using NMI timer interrupt.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 IP: [<ffffffff8123c226>] unregister_syscore_ops+0x41/0x58 PGD 42dbca067 PUD 41da6a067 PMD 0 Oops: 0002 [#1] PREEMPT SMP CPU 5 Modules linked in: oprofile(-) [last unloaded: oprofile]
Pid: 2518, comm: modprobe Not tainted 3.1.0-rc7-00019-gb2fb49d #19 Advanced Micro Device Anaheim/Anaheim
RIP: 0010:[<ffffffff8123c226>] [<ffffffff8123c226>] unregister_syscore_ops+0x41/0x58 RSP: 0018:ffff88041ef71e98 EFLAGS: 00010296 RAX: 0000000000000000 RBX: ffffffffa0017100 RCX: dead000000200200 RDX: 0000000000000000 RSI: dead000000100100 RDI: ffffffff8178c620 RBP: ffff88041ef71ea8 R08: 0000000000000001 R09: 0000000000000082 R10: 0000000000000000 R11: ffff88041ef71de8 R12: 0000000000000080 R13: fffffffffffffff5 R14: 0000000000000001 R15: 0000000000610210 FS: 00007fc902f20700(0000) GS:ffff88042fd40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000008 CR3: 000000041cdb6000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process modprobe (pid: 2518, threadinfo ffff88041ef70000, task ffff88041d348040) Stack: ffff88041ef71eb8 ffffffffa0017790 ffff88041ef71eb8 ffffffffa0013532 ffff88041ef71ec8 ffffffffa00132d6 ffff88041ef71ed8 ffffffffa00159b2 ffff88041ef71f78 ffffffff81073115 656c69666f72706f 0000000000610200 Call Trace: [<ffffffffa0013532>] op_nmi_exit+0x15/0x17 [oprofile] [<ffffffffa00132d6>] oprofile_arch_exit+0xe/0x10 [oprofile] [<ffffffffa00159b2>] oprofile_exit+0x1e/0x20 [oprofile] [<ffffffff81073115>] sys_delete_module+0x1c3/0x22f [<ffffffff811bf09e>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff8148070b>] system_call_fastpath+0x16/0x1b Code: 20 c6 78 81 e8 c5 cc 23 00 48 8b 13 48 8b 43 08 48 be 00 01 10 00 00 00 ad de 48 b9 00 02 20 00 00 00 ad de 48 c7 c7 20 c6 78 81 89 42 08 48 89 10 48 89 33 48 89 4b 08 e8 a6 c0 23 00 5a 5b RIP [<ffffffff8123c226>] unregister_syscore_ops+0x41/0x58 RSP <ffff88041ef71e98> CR2: 0000000000000008 ---[ end trace 43a541a52956b7b0 ]---
--- arch/x86/oprofile/init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/x86/oprofile/init.c +5 -2
@@ -21,6 +21,7 @@ extern int op_nmi_timer_init(struct oprofile_operations *ops);extern void op_nmi_exit (void );extern void x86_backtrace (struct pt_regs *const regs,unsigned int depth); +static int nmi_timer;int __init oprofile_arch_init (struct oprofile_operations *ops) {
@@ -31,8 +32,9 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)#ifdef CONFIG_X86_LOCAL_APIC ret =op_nmi_init (ops);#endif + nmi_timer = (ret !=0 );#ifdef CONFIG_X86_IO_APIC -if (ret <0 ) +if (nmi_timer) ret =op_nmi_timer_init (ops);#endif ops->backtrace = x86_backtrace;
@@ -44,6 +46,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)void oprofile_arch_exit (void ) {#ifdef CONFIG_X86_LOCAL_APIC -op_nmi_exit (); +if (!nmi_timer) +op_nmi_exit ();#endif }
Signature · 1 line
1.7.12.1
PATCH 41/77 genirq: Fix race condition when stopping the irq thread
In reply to Paul GortmakerFrom: Ido Yariv <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 550acb19269d65f32e9ac4ddb26c2b2070e37f1c upstream.
In irq_wait_for_interrupt(), the should_stop member is verified before setting the task's state to TASK_INTERRUPTIBLE and calling schedule(). In case kthread_stop sets should_stop and wakes up the process after should_stop is checked by the irq thread but before the task's state is changed, the irq thread might never exit:
kthread_stop irq_wait_for_interrupt
------------ ----------------------
...
... while (!kthread_should_stop()) {kthread->should_stop = 1;wake_up_process(k);wait_for_completion(&kthread->exited);
...
set_current_state(TASK_INTERRUPTIBLE);
...
schedule();
}Fix this by checking if the thread should stop after modifying the task's state.
[ tglx: Simplified it a bit ]
--- kernel/irq/manage.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/irq/manage.c +4 -1
@@ -479,8 +479,9 @@ static irqreturn_t irq_nested_primary_handler(int irq, void *dev_id)static int irq_wait_for_interrupt (struct irqaction *action) { +set_current_state (TASK_INTERRUPTIBLE ); +while (!kthread_should_stop ()) { -set_current_state (TASK_INTERRUPTIBLE );if (test_and_clear_bit (IRQTF_RUNTHREAD , &action->thread_flags)) {
@@ -488,7 +489,9 @@ static int irq_wait_for_interrupt(struct irqaction *action)return 0 ; }schedule (); +set_current_state (TASK_INTERRUPTIBLE ); } +__set_current_state (TASK_RUNNING );return -1 ; }
Signature · 1 line
1.7.12.1
PATCH 42/77 tick-broadcast: Stop active broadcast device when replacing it
In reply to Paul GortmakerFrom: Thomas Gleixner <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit c1be84309c58b1e7c6d626e28fba41a22b364c3d upstream.
When a better rated broadcast device is installed, then the current active device is not disabled, which results in two running broadcast devices.
--- kernel/time/tick-broadcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-broadcast.c +1 -1
@@ -72,7 +72,7 @@ int tick_check_broadcast_device(struct clock_event_device *dev) (dev->features & CLOCK_EVT_FEAT_C3STOP))return 0 ; -clockevents_exchange_device (NULL , dev); +clockevents_exchange_device (tick_broadcast_device.evtdev, dev); tick_broadcast_device.evtdev = dev;if (!cpumask_empty (tick_get_broadcast_mask ()))tick_broadcast_start_periodic (dev);
Signature · 1 line
1.7.12.1
PATCH 43/77 ALSA: sis7019 - give slow codecs more time to reset
In reply to Paul GortmakerFrom: David Dillow <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit fc084e0b930d546872ab23667052499f7daf0fed upstream.
There are some AC97 codec and board combinations that have been observed to take a very long time to respond after the cold reset has completed. In one case, more than 350 ms was required. To allow users to have sound on those platforms, we'll wait up to 500ms for the codec to become ready.
As a board may have multiple codecs, with some faster than others to reset, we add a module parameter to inform the driver which codecs should be present.
--- sound/pci/sis7019.c | 64 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 11 deletions(-)
sound/pci/sis7019.c +53 -11
@@ -41,6 +41,7 @@ MODULE_SUPPORTED_DEVICE("{{SiS,SiS7019 Audio Accelerator}}");static int index =SNDRV_DEFAULT_IDX1 ;/* Index 0-MAX */ static char *id =SNDRV_DEFAULT_STR1 ;/* ID for this card */ static int enable =1 ; +static int codecs =1 ;module_param (index, int,0444 );MODULE_PARM_DESC (index,"Index value for SiS7019 Audio Accelerator." );
@@ -48,6 +49,8 @@ module_param(id, charp, 0444);MODULE_PARM_DESC (id,"ID string for SiS7019 Audio Accelerator." );module_param (enable, bool,0444 );MODULE_PARM_DESC (enable,"Enable SiS7019 Audio Accelerator." ); +module_param (codecs, int,0444 ); +MODULE_PARM_DESC (codecs,"Set bit to indicate that codec number is expected to be present (default 1)" );static DEFINE_PCI_DEVICE_TABLE (snd_sis7019_ids) = { {PCI_DEVICE (PCI_VENDOR_ID_SI ,0x7019 ) },
@@ -140,6 +143,9 @@ struct sis7019 {dma_addr_t silence_dma_addr; }; +/* These values are also used by the module param 'codecs' to indicate +* which codecs should be present. +*/ #define SIS_PRIMARY_CODEC_PRESENT 0x0001#define SIS_SECONDARY_CODEC_PRESENT 0x0002#define SIS_TERTIARY_CODEC_PRESENT 0x0004
@@ -1076,6 +1082,7 @@ static int sis_chip_init(struct sis7019 *sis) {unsigned long io = sis->ioport;void __iomem *ioaddr = sis->ioaddr; +unsigned long timeout;u16 status;int count;int i;
@@ -1102,21 +1109,45 @@ static int sis_chip_init(struct sis7019 *sis)while ((inw (io +SIS_AC97_STATUS ) &SIS_AC97_STATUS_BUSY ) && --count)udelay (1 ); +/* Command complete, we can let go of the semaphore now. +*/ +outl (SIS_AC97_SEMA_RELEASE , io +SIS_AC97_SEMA ); +if (!count) +return -EIO ; +/* Now that we've finished the reset, find out what's attached. +* There are some codec/board combinations that take an extremely +* long time to come up. 350+ ms has been observed in the field, +* so we'll give them up to 500ms. */ - status =inl (io +SIS_AC97_STATUS ); -if (status &SIS_AC97_STATUS_CODEC_READY ) - sis->codecs_present |=SIS_PRIMARY_CODEC_PRESENT ; -if (status &SIS_AC97_STATUS_CODEC2_READY ) - sis->codecs_present |=SIS_SECONDARY_CODEC_PRESENT ; -if (status &SIS_AC97_STATUS_CODEC3_READY ) - sis->codecs_present |=SIS_TERTIARY_CODEC_PRESENT ; - -/* All done, let go of the semaphore, and check for errors + sis->codecs_present =0 ; + timeout =msecs_to_jiffies (500 ) + jiffies; +while (time_before_eq (jiffies, timeout)) { + status =inl (io +SIS_AC97_STATUS ); +if (status &SIS_AC97_STATUS_CODEC_READY ) + sis->codecs_present |=SIS_PRIMARY_CODEC_PRESENT ; +if (status &SIS_AC97_STATUS_CODEC2_READY ) + sis->codecs_present |=SIS_SECONDARY_CODEC_PRESENT ; +if (status &SIS_AC97_STATUS_CODEC3_READY ) + sis->codecs_present |=SIS_TERTIARY_CODEC_PRESENT ; + +if (sis->codecs_present == codecs) +break ; + +msleep (1 ); + } + +/* All done, check for errors. */ -outl (SIS_AC97_SEMA_RELEASE , io +SIS_AC97_SEMA ); -if (!sis->codecs_present || !count) +if (!sis->codecs_present) { +printk (KERN_ERR "sis7019: could not find any codecs\n" );return -EIO ; + } + +if (sis->codecs_present != codecs) { +printk (KERN_WARNING "sis7019: missing codecs, found %0x, expected %0x\n" , + sis->codecs_present, codecs); + }/* Let the hardware know that the audio driver is alive, * and enable PCM slots on the AC-link for L/R playback (3 & 4) and
@@ -1388,6 +1419,17 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci,if (!enable) goto error_out; +/* The user can specify which codecs should be present so that we +* can wait for them to show up if they are slow to recover from +* the AC97 cold reset. We default to a single codec, the primary. +* +* We assume that SIS_PRIMARY_*_PRESENT matches bits 0-2. +*/ + codecs &=SIS_PRIMARY_CODEC_PRESENT |SIS_SECONDARY_CODEC_PRESENT | +SIS_TERTIARY_CODEC_PRESENT ; +if (!codecs) + codecs =SIS_PRIMARY_CODEC_PRESENT ; + rc =snd_card_create (index, id,THIS_MODULE ,sizeof (*sis), &card);if (rc <0 ) goto error_out;
Signature · 1 line
1.7.12.1
PATCH 44/77 ALSA: hda/realtek - Fix Oops in alc_mux_select()
In reply to Paul GortmakerFrom: Takashi Iwai <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit cce4aa378a049f4275416ee6302dd24f37b289df upstream.
When no imux is available (e.g. a single capture source), alc_auto_init_input_src() may trigger an Oops due to the access to -1. Add a proper zero-check to avoid it.
[PG: in mainline, 21268961d3 rewrites and creates alc_mux_select, but the code that needed the check still existed prior to that in alc_mux_enum_put]
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -444,6 +444,8 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, imux = &spec->input_mux[mux_idx];if (!imux->num_items && mux_idx >0 ) imux = &spec->input_mux[0 ]; +if (!imux->num_items) +return 0 ; type =get_wcaps_type (get_wcaps (codec, nid));if (type ==AC_WID_AUD_MIX ) {
Signature · 1 line
1.7.12.1
PATCH 45/77 ARM: davinci: dm646x evm: wrong register used in setup_vpif_input_channel_mode
In reply to Paul GortmakerFrom: Hans Verkuil <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 83713fc9373be2e943f82e9d36213708c6b0050e upstream.
The function setup_vpif_input_channel_mode() used the VSCLKDIS register instead of VIDCLKCTL. This meant that when in HD mode videoport channel 0 used a different clock from channel 1.
Clearly a copy-and-paste error.
--- arch/arm/mach-davinci/board-dm646x-evm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-davinci/board-dm646x-evm.c +3 -3
@@ -555,7 +555,7 @@ static int setup_vpif_input_channel_mode(int mux_mode)int val;u32 value; -if (!vpif_vsclkdis_reg || !cpld_client) +if (!vpif_vidclkctl_reg || !cpld_client)return -ENXIO ; val =i2c_smbus_read_byte (cpld_client);
@@ -563,7 +563,7 @@ static int setup_vpif_input_channel_mode(int mux_mode)return val;spin_lock_irqsave (&vpif_reg_lock, flags); - value =__raw_readl (vpif_vsclkdis_reg); + value =__raw_readl (vpif_vidclkctl_reg);if (mux_mode) { val &=VPIF_INPUT_TWO_CHANNEL ; value |=VIDCH1CLK ;
@@ -571,7 +571,7 @@ static int setup_vpif_input_channel_mode(int mux_mode) val |=VPIF_INPUT_ONE_CHANNEL ; value &= ~VIDCH1CLK ; } -__raw_writel (value, vpif_vsclkdis_reg); +__raw_writel (value, vpif_vidclkctl_reg);spin_unlock_irqrestore (&vpif_reg_lock, flags); err =i2c_smbus_write_byte (cpld_client, val);
Signature · 1 line
1.7.12.1
PATCH 46/77 oprofile: Free potentially owned tasks in case of errors
In reply to Paul GortmakerFrom: Robert Richter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 6ac6519b93065625119a347be1cbcc1b89edb773 upstream.
After registering the task free notifier we possibly have tasks in our dying_tasks list. Free them after unregistering the notifier in case of an error.
--- drivers/oprofile/buffer_sync.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/oprofile/buffer_sync.c +9 -4
@@ -141,6 +141,13 @@ static struct notifier_block module_load_nb = { .notifier_call = module_load_notify, }; +static void free_all_tasks (void ) +{ +/* make sure we don't leak task structs */ +process_task_mortuary (); +process_task_mortuary (); +} +int sync_start (void ) {int err;
@@ -174,6 +181,7 @@ out3:profile_event_unregister (PROFILE_TASK_EXIT , &task_exit_nb); out2:task_handoff_unregister (&task_free_nb); +free_all_tasks (); out1:free_cpumask_var (marked_cpus); goto out;
@@ -192,10 +200,7 @@ void sync_stop(void)mutex_unlock (&buffer_mutex);flush_scheduled_work (); -/* make sure we don't leak task structs */ -process_task_mortuary (); -process_task_mortuary (); - +free_all_tasks ();free_cpumask_var (marked_cpus); }
Signature · 1 line
1.7.12.1
PATCH 47/77 oprofile: Fix locking dependency in sync_start()
In reply to Paul GortmakerFrom: Robert Richter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 130c5ce716c9bfd1c2a2ec840a746eb7ff9ce1e6 upstream.
This fixes the A->B/B->A locking dependency, see the warning below.
The function task_exit_notify() is called with (task_exit_notifier) .rwsem set and then calls sync_buffer() which locks buffer_mutex. In sync_start() the buffer_mutex was set to prevent notifier functions to be started before sync_start() is finished. But when registering the notifier, (task_exit_notifier).rwsem is locked too, but now in different order than in sync_buffer(). In theory this causes a locking dependency, what does not occur in practice since task_exit_notify() is always called after the notifier is registered which means the lock is already released.
However, after checking the notifier functions it turned out the buffer_mutex in sync_start() is unnecessary. This is because sync_buffer() may be called from the notifiers even if sync_start() did not finish yet, the buffers are already allocated but empty. No need to protect this with the mutex.
So we fix this theoretical locking dependency by removing buffer_mutex in sync_start(). This is similar to the implementation before commit:
750d857 oprofile: fix crash when accessing freed task structs
which introduced the locking dependency.
Lockdep warning:
oprofiled/4447 is trying to acquire lock:
(buffer_mutex){+.+...}, at: [<ffffffffa0000e55>] sync_buffer+0x31/0x3ec [oprofile]
but task is already holding lock:
((task_exit_notifier).rwsem){++++..}, at: [<ffffffff81058026>] __blocking_notifier_call_chain+0x39/0x67
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 ((task_exit_notifier).rwsem){++++..}:
[<ffffffff8106557f>] lock_acquire+0xf8/0x11e
[<ffffffff81463a2b>] down_write+0x44/0x67
[<ffffffff810581c0>] blocking_notifier_chain_register+0x52/0x8b
[<ffffffff8105a6ac>] profile_event_register+0x2d/0x2f
[<ffffffffa00013c1>] sync_start+0x47/0xc6 [oprofile]
[<ffffffffa00001bb>] oprofile_setup+0x60/0xa5 [oprofile]
[<ffffffffa00014e3>] event_buffer_open+0x59/0x8c [oprofile]
[<ffffffff810cd3b9>] __dentry_open+0x1eb/0x308
[<ffffffff810cd59d>] nameidata_to_filp+0x60/0x67
[<ffffffff810daad6>] do_last+0x5be/0x6b2
[<ffffffff810dbc33>] path_openat+0xc7/0x360
[<ffffffff810dbfc5>] do_filp_open+0x3d/0x8c
[<ffffffff810ccfd2>] do_sys_open+0x110/0x1a9
[<ffffffff810cd09e>] sys_open+0x20/0x22
[<ffffffff8146ad4b>] system_call_fastpath+0x16/0x1b-> #0 (buffer_mutex){+.+...}:
[<ffffffff81064dfb>] __lock_acquire+0x1085/0x1711
[<ffffffff8106557f>] lock_acquire+0xf8/0x11e
[<ffffffff814634f0>] mutex_lock_nested+0x63/0x309
[<ffffffffa0000e55>] sync_buffer+0x31/0x3ec [oprofile]
[<ffffffffa0001226>] task_exit_notify+0x16/0x1a [oprofile]
[<ffffffff81467b96>] notifier_call_chain+0x37/0x63
[<ffffffff8105803d>] __blocking_notifier_call_chain+0x50/0x67
[<ffffffff81058068>] blocking_notifier_call_chain+0x14/0x16
[<ffffffff8105a718>] profile_task_exit+0x1a/0x1c
[<ffffffff81039e8f>] do_exit+0x2a/0x6fc
[<ffffffff8103a5e4>] do_group_exit+0x83/0xae
[<ffffffff8103a626>] sys_exit_group+0x17/0x1b
[<ffffffff8146ad4b>] system_call_fastpath+0x16/0x1bother info that might help us debug this:
1 lock held by oprofiled/4447:
#0: ((task_exit_notifier).rwsem){++++..}, at: [<ffffffff81058026>] __blocking_notifier_call_chain+0x39/0x67
stack backtrace: Pid: 4447, comm: oprofiled Not tainted 2.6.39-00007-gcf4d8d4 #10 Call Trace: [<ffffffff81063193>] print_circular_bug+0xae/0xbc [<ffffffff81064dfb>] __lock_acquire+0x1085/0x1711 [<ffffffffa0000e55>] ? sync_buffer+0x31/0x3ec [oprofile] [<ffffffff8106557f>] lock_acquire+0xf8/0x11e [<ffffffffa0000e55>] ? sync_buffer+0x31/0x3ec [oprofile] [<ffffffff81062627>] ? mark_lock+0x42f/0x552 [<ffffffffa0000e55>] ? sync_buffer+0x31/0x3ec [oprofile] [<ffffffff814634f0>] mutex_lock_nested+0x63/0x309 [<ffffffffa0000e55>] ? sync_buffer+0x31/0x3ec [oprofile] [<ffffffffa0000e55>] sync_buffer+0x31/0x3ec [oprofile] [<ffffffff81058026>] ? __blocking_notifier_call_chain+0x39/0x67 [<ffffffff81058026>] ? __blocking_notifier_call_chain+0x39/0x67 [<ffffffffa0001226>] task_exit_notify+0x16/0x1a [oprofile] [<ffffffff81467b96>] notifier_call_chain+0x37/0x63 [<ffffffff8105803d>] __blocking_notifier_call_chain+0x50/0x67 [<ffffffff81058068>] blocking_notifier_call_chain+0x14/0x16 [<ffffffff8105a718>] profile_task_exit+0x1a/0x1c [<ffffffff81039e8f>] do_exit+0x2a/0x6fc [<ffffffff81465031>] ? retint_swapgs+0xe/0x13 [<ffffffff8103a5e4>] do_group_exit+0x83/0xae [<ffffffff8103a626>] sys_exit_group+0x17/0x1b [<ffffffff8146ad4b>] system_call_fastpath+0x16/0x1b
--- drivers/oprofile/buffer_sync.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/oprofile/buffer_sync.c +2 -6
@@ -155,8 +155,6 @@ int sync_start(void)if (!zalloc_cpumask_var (&marked_cpus,GFP_KERNEL ))return -ENOMEM ; -mutex_lock (&buffer_mutex); - err =task_handoff_register (&task_free_nb);if (err) goto out1;
@@ -173,7 +171,6 @@ int sync_start(void)start_cpu_work (); out: -mutex_unlock (&buffer_mutex);return err; out4:profile_event_unregister (PROFILE_MUNMAP , &munmap_nb);
@@ -190,14 +187,13 @@ out1:void sync_stop (void ) { -/* flush buffers */ -mutex_lock (&buffer_mutex);end_cpu_work ();unregister_module_notifier (&module_load_nb);profile_event_unregister (PROFILE_MUNMAP , &munmap_nb);profile_event_unregister (PROFILE_TASK_EXIT , &task_exit_nb);task_handoff_unregister (&task_free_nb); -mutex_unlock (&buffer_mutex); +barrier ();/* do all of the above first */ +flush_scheduled_work ();free_all_tasks ();
Signature · 1 line
1.7.12.1
PATCH 48/77 percpu: fix first chunk match in per_cpu_ptr_to_phys()
In reply to Paul GortmakerFrom: Tejun Heo <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 9983b6f0cf8263e51bcf4c8a9dc0c1ef175b3c60 upstream.
per_cpu_ptr_to_phys() determines whether the passed in @addr belongs to the first_chunk or not by just matching the address against the address range of the base unit (unit0, used by cpu0). When an adress from another cpu was passed in, it will always determine that the address doesn't belong to the first chunk even when it does. This makes the function return a bogus physical address which may lead to crash.
This problem was discovered by Cliff Wickman while investigating a crash during kdump on a SGI UV system.
[PG: for 2.6.34, diffstat differs slightly due to a trivial indenting
difference, and 34 does not have the _maybe_unused annotation to delete]
--- mm/percpu.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-)
mm/percpu.c +29 -3
@@ -1343,10 +1343,36 @@ bool is_kernel_percpu_address(unsigned long addr)*/ phys_addr_t per_cpu_ptr_to_phys (void *addr) { -if ((unsigned long )addr <VMALLOC_START || - (unsigned long )addr >=VMALLOC_END ) +void __percpu *base =__addr_to_pcpu_ptr (pcpu_base_addr); +bool in_first_chunk = false; +unsigned long first_start, first_end; +unsigned int cpu; + +/* +* The following test on first_start/end isn't strictly +* necessary but will speed up lookups of addresses which +* aren't in the first chunk. +*/ + first_start =pcpu_chunk_addr (pcpu_first_chunk, pcpu_first_unit_cpu,0 ); + first_end =pcpu_chunk_addr (pcpu_first_chunk, pcpu_last_unit_cpu, + pcpu_unit_pages); +if ((unsigned long )addr >= first_start && + (unsigned long )addr < first_end) { +for_each_possible_cpu (cpu) { +void *start =per_cpu_ptr (base, cpu); + +if (addr >= start && addr < start + pcpu_unit_size) { + in_first_chunk = true; +break ; + } + } + } + +if (in_first_chunk) { +if ((unsigned long )addr <VMALLOC_START || + (unsigned long )addr >=VMALLOC_END )return __pa (addr); -else + }else return page_to_phys (vmalloc_to_page (addr)); }
Signature · 1 line
1.7.12.1
PATCH 49/77 percpu: fix chunk range calculation
In reply to Paul GortmakerFrom: Tejun Heo <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit a855b84c3d8c73220d4d3cd392a7bee7c83de70e upstream.
Percpu allocator recorded the cpus which map to the first and last units in pcpu_first/last_unit_cpu respectively and used them to determine the address range of a chunk - e.g. it assumed that the first unit has the lowest address in a chunk while the last unit has the highest address.
This simply isn't true. Groups in a chunk can have arbitrary positive or negative offsets from the previous one and there is no guarantee that the first unit occupies the lowest offset while the last one the highest.
Fix it by actually comparing unit offsets to determine cpus occupying the lowest and highest offsets. Also, rename pcu_first/last_unit_cpu to pcpu_low/high_unit_cpu to avoid confusion.
The chunk address range is used to flush cache on vmalloc area map/unmap and decide whether a given address is in the first chunk by per_cpu_ptr_to_phys() and the bug was discovered by invalid per_cpu_ptr_to_phys() translation for crash_note.
Kudos to Dave Young for tracking down the problem.
LKML-Reference: <[email protected]>
--- mm/percpu.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-)
mm/percpu.c +26 -20
@@ -111,9 +111,9 @@ static int pcpu_atom_size __read_mostly;static int pcpu_nr_slots__read_mostly ;static size_t pcpu_chunk_struct_size__read_mostly ; -/* cpus with the lowest and highest unit numbers */ -static unsigned int pcpu_first_unit_cpu__read_mostly ; -static unsigned int pcpu_last_unit_cpu__read_mostly ; +/* cpus with the lowest and highest unit addresses */ +static unsigned int pcpu_low_unit_cpu__read_mostly ; +static unsigned int pcpu_high_unit_cpu__read_mostly ;/* the address of the first chunk which starts with the kernel static area */ void *pcpu_base_addr__read_mostly ;
@@ -747,8 +747,8 @@ static void pcpu_pre_unmap_flush(struct pcpu_chunk *chunk, int page_start, int page_end) {flush_cache_vunmap ( -pcpu_chunk_addr (chunk ,pcpu_first_unit_cpu ,page_start ), -pcpu_chunk_addr (chunk ,pcpu_last_unit_cpu ,page_end )); +pcpu_chunk_addr (chunk ,pcpu_low_unit_cpu ,page_start ), +pcpu_chunk_addr (chunk ,pcpu_high_unit_cpu ,page_end )); }static void __pcpu_unmap_pages (unsigned long addr,int nr_pages)
@@ -810,8 +810,8 @@ static void pcpu_post_unmap_tlb_flush(struct pcpu_chunk *chunk, int page_start, int page_end) {flush_tlb_kernel_range ( -pcpu_chunk_addr (chunk ,pcpu_first_unit_cpu ,page_start ), -pcpu_chunk_addr (chunk ,pcpu_last_unit_cpu ,page_end )); +pcpu_chunk_addr (chunk ,pcpu_low_unit_cpu ,page_start ), +pcpu_chunk_addr (chunk ,pcpu_high_unit_cpu ,page_end )); } static int __pcpu_map_pages(unsigned long addr, struct page **pages,
@@ -888,8 +888,8 @@ static void pcpu_post_map_flush(struct pcpu_chunk *chunk, int page_start, int page_end) {flush_cache_vmap ( -pcpu_chunk_addr (chunk ,pcpu_first_unit_cpu ,page_start ), -pcpu_chunk_addr (chunk ,pcpu_last_unit_cpu ,page_end )); +pcpu_chunk_addr (chunk ,pcpu_low_unit_cpu ,page_start ), +pcpu_chunk_addr (chunk ,pcpu_high_unit_cpu ,page_end )); }/**
@@ -1345,19 +1345,19 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr) {void __percpu *base =__addr_to_pcpu_ptr (pcpu_base_addr);bool in_first_chunk = false; -unsigned long first_start, first_end; +unsigned long first_low, first_high;unsigned int cpu;/* -* The following test on first_start/end isn't strictly +* The following test on unit_low/high isn't strictly * necessary but will speed up lookups of addresses which * aren't in the first chunk. */ - first_start =pcpu_chunk_addr (pcpu_first_chunk, pcpu_first_unit_cpu,0 ); - first_end =pcpu_chunk_addr (pcpu_first_chunk, pcpu_last_unit_cpu, - pcpu_unit_pages); -if ((unsigned long )addr >= first_start && - (unsigned long )addr < first_end) { + first_low =pcpu_chunk_addr (pcpu_first_chunk, pcpu_low_unit_cpu,0 ); + first_high =pcpu_chunk_addr (pcpu_first_chunk, pcpu_high_unit_cpu, + pcpu_unit_pages); +if ((unsigned long )addr >= first_low && + (unsigned long )addr < first_high) {for_each_possible_cpu (cpu) {void *start =per_cpu_ptr (base, cpu);
@@ -1754,7 +1754,9 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,for (cpu =0 ; cpu < nr_cpu_ids; cpu++) unit_map[cpu] =UINT_MAX ; - pcpu_first_unit_cpu =NR_CPUS ; + + pcpu_low_unit_cpu =NR_CPUS ; + pcpu_high_unit_cpu =NR_CPUS ;for (group =0 , unit =0 ; group < ai->nr_groups; group++, unit += i) {const struct pcpu_group_info *gi = &ai->groups[group];
@@ -1774,9 +1776,13 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, unit_map[cpu] = unit + i; unit_off[cpu] = gi->base_offset + i * ai->unit_size; -if (pcpu_first_unit_cpu ==NR_CPUS ) - pcpu_first_unit_cpu = cpu; - pcpu_last_unit_cpu = cpu; +/* determine low/high unit_cpu */ +if (pcpu_low_unit_cpu ==NR_CPUS || + unit_off[cpu] < unit_off[pcpu_low_unit_cpu]) + pcpu_low_unit_cpu = cpu; +if (pcpu_high_unit_cpu ==NR_CPUS || + unit_off[cpu] > unit_off[pcpu_high_unit_cpu]) + pcpu_high_unit_cpu = cpu; } } pcpu_nr_units = unit;
Signature · 1 line
1.7.12.1
PATCH 50/77 xfrm: Fix key lengths for rfc3686(ctr(aes))
In reply to Paul GortmakerFrom: Tushar Gohad <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 4203223a1aed862b4445fdcd260d6139603a51d9 upstream.
Fix the min and max bit lengths for AES-CTR (RFC3686) keys. The number of bits in key spec is the key length (128/256) plus 32 bits of nonce.
This change takes care of the "Invalid key length" errors reported by setkey when specifying 288 bit keys for aes-ctr.
--- net/xfrm/xfrm_algo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/xfrm/xfrm_algo.c +2 -2
@@ -462,8 +462,8 @@ static struct xfrm_algo_desc ealg_list[] = { .desc = { .sadb_alg_id = SADB_X_EALG_AESCTR, .sadb_alg_ivlen = 8, - .sadb_alg_minbits = 128, - .sadb_alg_maxbits = 256 + .sadb_alg_minbits = 160, + .sadb_alg_maxbits = 288 } }, };
Signature · 1 line
1.7.12.1
PATCH 51/77 linux/log2.h: Fix rounddown_pow_of_two(1)
In reply to Paul GortmakerFrom: Linus Torvalds <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 13c07b0286d340275f2d97adf085cecda37ede37 upstream.
Exactly like roundup_pow_of_two(1), the rounddown version was buggy for the case of a compile-time constant '1' argument. Probably because it originated from the same code, sharing history with the roundup version from before the bugfix (for that one, see commit 1a06a52ee1b0: "Fix roundup_pow_of_two(1)").
However, unlike the roundup version, the fix for rounddown is to just remove the broken special case entirely. It's simply not needed - the generic code
1UL << ilog2(n)
does the right thing for the constant '1' argment too. The only reason roundup needed that special case was because rounding up does so by subtracting one from the argument (and then adding one to the result) causing the obvious problems with "ilog2(0)".
But rounddown doesn't do any of that, since ilog2() naturally truncates (ie "rounds down") to the right rounded down value. And without the ilog2(0) case, there's no reason for the special case that had the wrong value.
tl;dr: rounddown_pow_of_two(1) should be 1, not 0.
--- include/linux/log2.h | 1 - 1 file changed, 1 deletion(-)
include/linux/log2.h +0 -1
@@ -185,7 +185,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n)#define rounddown_pow_of_two (n) \ ( \ __builtin_constant_p(n) ? ( \ - (n == 1) ? 0 : \ (1UL << ilog2(n))) : \ __rounddown_pow_of_two(n) \ )
Signature · 1 line
1.7.12.1
PATCH 52/77 jbd/jbd2: validate sb->s_first in journal_get_superblock()
In reply to Paul GortmakerFrom: Eryu Guan <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 8762202dd0d6e46854f786bdb6fb3780a1625efe upstream.
I hit a J_ASSERT(blocknr != 0) failure in cleanup_journal_tail() when mounting a fsfuzzed ext3 image. It turns out that the corrupted ext3 image has s_first = 0 in journal superblock, and the 0 is passed to journal->j_head in journal_reset(), then to blocknr in cleanup_journal_tail(), in the end the J_ASSERT failed.
So validate s_first after reading journal superblock from disk in journal_get_superblock() to ensure s_first is valid.
The following script could reproduce it:
fstype=ext3
blocksize=1024
img=$fstype.img
offset=0
found=0
magic="c0 3b 39 98"
dd if=/dev/zero of=$img bs=1M count=8
mkfs -t $fstype -b $blocksize -F $img
filesize=stat -c %s $img
while [ $offset -lt $filesize ]
do
if od -j $offset -N 4 -t x1 $img | grep -i "$magic";then
echo "Found journal: $offset"
found=1
break
fi
offset=echo "$offset+$blocksize" | bc
done
if [ $found -ne 1 ];then
echo "Magic \"$magic\" not found"
exit 1
fi
dd if=/dev/zero of=$img seek=$(($offset+23)) conv=notrunc bs=1 count=1
mkdir -p ./mnt
mount -o loop $img ./mnt
--- fs/jbd/journal.c | 8 ++++++++ fs/jbd2/journal.c | 8 ++++++++ 2 files changed, 16 insertions(+)
fs/jbd/journal.c +8 -0
@@ -1070,6 +1070,14 @@ static int journal_get_superblock(journal_t *journal) goto out; } +if (be32_to_cpu (sb->s_first) ==0 || +be32_to_cpu (sb->s_first) >= journal->j_maxlen) { +printk (KERN_WARNING +"JBD: Invalid start block of journal: %u\n" , +be32_to_cpu (sb->s_first)); + goto out; + } +return 0 ; out:
fs/jbd2/journal.c +8 -0
@@ -1186,6 +1186,14 @@ static int journal_get_superblock(journal_t *journal) goto out; } +if (be32_to_cpu (sb->s_first) ==0 || +be32_to_cpu (sb->s_first) >= journal->j_maxlen) { +printk (KERN_WARNING +"JBD2: Invalid start block of journal: %u\n" , +be32_to_cpu (sb->s_first)); + goto out; + } +return 0 ; out:
Signature · 1 line
1.7.12.1
PATCH 53/77 Make TASKSTATS require root access
In reply to Paul GortmakerFrom: Linus Torvalds <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 1a51410abe7d0ee4b1d112780f46df87d3621043 upstream.
Ok, this isn't optimal, since it means that 'iotop' needs admin capabilities, and we may have to work on this some more. But at the same time it is very much not acceptable to let anybody just read anybody elses IO statistics quite at this level.
Use of the GENL_ADMIN_PERM suggested by Johannes Berg as an alternative to checking the capabilities by hand.
--- kernel/taskstats.c | 1 + 1 file changed, 1 insertion(+)
kernel/taskstats.c +1 -0
@@ -591,6 +591,7 @@ static struct genl_ops taskstats_ops = { .cmd = TASKSTATS_CMD_GET, .doit = taskstats_user_cmd, .policy = taskstats_cmd_get_policy, + .flags = GENL_ADMIN_PERM, };static struct genl_ops cgroupstats_ops = {
Signature · 1 line
1.7.12.1
PATCH 54/77 hfs: fix hfs_find_init() sb->ext_tree NULL ptr oops
In reply to Paul GortmakerFrom: Phillip Lougher <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 434a964daa14b9db083ce20404a4a2add54d037a upstream.
Clement Lecigne reports a filesystem which causes a kernel oops in hfs_find_init() trying to dereference sb->ext_tree which is NULL.
This proves to be because the filesystem has a corrupted MDB extent record, where the extents file does not fit into the first three extents in the file record (the first blocks).
In hfs_get_block() when looking up the blocks for the extent file (HFS_EXT_CNID), it fails the first blocks special case, and falls through to the extent code (which ultimately calls hfs_find_init()) which is in the process of being initialised.
Hfs avoids this scenario by always having the extents b-tree fitting into the first blocks (the extents B-tree can't have overflow extents).
The fix is to check at mount time that the B-tree fits into first blocks, i.e. fail if HFS_I(inode)->alloc_blocks >= HFS_I(inode)->first_blocks
Note, the existing commit 47f365eb57573 ("hfs: fix oops on mount with corrupted btree extent records") becomes subsumed into this as a special case, but only for the extents B-tree (HFS_EXT_CNID), it is perfectly acceptable for the catalog B-Tree file to grow beyond three extents, with the remaining extent descriptors in the extents overfow.
This fixes CVE-2011-2203
--- fs/hfs/btree.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
fs/hfs/btree.c +15 -5
@@ -46,11 +46,26 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp kecase HFS_EXT_CNID :hfs_inode_read_fork (tree->inode, mdb->drXTExtRec, mdb->drXTFlSize, mdb->drXTFlSize,be32_to_cpu (mdb->drXTClpSiz)); +if (HFS_I (tree->inode)->alloc_blocks > +HFS_I (tree->inode)->first_blocks) { +printk (KERN_ERR "hfs: invalid btree extent records\n" ); +unlock_new_inode (tree->inode); + goto free_inode; + } + tree->inode->i_mapping->a_ops = &hfs_btree_aops;break ;case HFS_CAT_CNID :hfs_inode_read_fork (tree->inode, mdb->drCTExtRec, mdb->drCTFlSize, mdb->drCTFlSize,be32_to_cpu (mdb->drCTClpSiz)); + +if (!HFS_I (tree->inode)->first_blocks) { +printk (KERN_ERR "hfs: invalid btree extent records " +"(0 size).\n" ); +unlock_new_inode (tree->inode); + goto free_inode; + } + tree->inode->i_mapping->a_ops = &hfs_btree_aops;break ;default :
@@ -59,11 +74,6 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke }unlock_new_inode (tree->inode); -if (!HFS_I (tree->inode)->first_blocks) { -printk (KERN_ERR "hfs: invalid btree extent records (0 size).\n" ); - goto free_inode; - } - mapping = tree->inode->i_mapping; page =read_mapping_page (mapping,0 ,NULL );if (IS_ERR (page))
Signature · 1 line
1.7.12.1
PATCH 55/77 export __get_user_pages_fast() function
In reply to Paul GortmakerFrom: Xiao Guangrong <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 45888a0c6edc305495b6bd72a30e66bc40b324c6 upstream.
This function is used by KVM to pin process's page in the atomic context.
Define the 'weak' function to avoid other architecture not support it
--- mm/util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
mm/util.c +13 -0
@@ -250,6 +250,19 @@ void arch_pick_mmap_layout(struct mm_struct *mm) }#endif +/* +* Like get_user_pages_fast() except its IRQ-safe in that it won't fall +* back to the regular GUP. +* If the architecture not support this fucntion, simply return with no +* page pinned +*/ +int __attribute__((weak))__get_user_pages_fast (unsigned long start, +int nr_pages,int write,struct page **pages) +{ +return 0 ; +} +EXPORT_SYMBOL_GPL (__get_user_pages_fast); +/** * get_user_pages_fast() - pin user pages in memory * @start: starting user address
Signature · 1 line
1.7.12.1
PATCH 56/77 oprofile, x86: Fix nmi-unsafe callgraph support
In reply to Paul GortmakerFrom: Robert Richter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit a0e3e70243f5b270bc3eca718f0a9fa5e6b8262e upstream.
Backport for stable kernel v2.6.32.y to v2.6.36.y.
Current oprofile's x86 callgraph support may trigger page faults throwing the BUG_ON(in_nmi()) message below. This patch fixes this by using the same nmi-safe copy-from-user code as in perf.
------------[ cut here ]------------ kernel BUG at .../arch/x86/kernel/traps.c:436! invalid opcode: 0000 [#1] SMP last sysfs file: /sys/devices/pci0000:00/0000:00:0a.0/0000:07:00.0/0000:08:04.0/net/eth0/broadcast CPU 5 Modules linked in:
Pid: 8611, comm: opcontrol Not tainted 2.6.39-00007-gfe47ae7 #1 Advanced Micro Device Anaheim/Anaheim
RIP: 0010:[<ffffffff813e8e35>] [<ffffffff813e8e35>] do_nmi+0x22/0x1ee RSP: 0000:ffff88042fd47f28 EFLAGS: 00010002 RAX: ffff88042c0a7fd8 RBX: 0000000000000001 RCX: 00000000c0000101 RDX: 00000000ffff8804 RSI: ffffffffffffffff RDI: ffff88042fd47f58 RBP: ffff88042fd47f48 R08: 0000000000000004 R09: 0000000000001484 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88042fd47f58 R13: 0000000000000000 R14: ffff88042fd47d98 R15: 0000000000000020 FS: 00007fca25e56700(0000) GS:ffff88042fd40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000074 CR3: 000000042d28b000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process opcontrol (pid: 8611, threadinfo ffff88042c0a6000, task ffff88042c532310) Stack: 0000000000000000 0000000000000001 ffff88042c0a7fd8 0000000000000000 ffff88042fd47de8 ffffffff813e897a 0000000000000020 ffff88042fd47d98 0000000000000000 ffff88042c0a7fd8 ffff88042fd47de8 0000000000000074 Call Trace: <NMI> [<ffffffff813e897a>] nmi+0x1a/0x20 [<ffffffff813f08ab>] ? bad_to_user+0x25/0x771 <<EOE>> Code: ff 59 5b 41 5c 41 5d c9 c3 55 65 48 8b 04 25 88 b5 00 00 48 89 e5 41 55 41 54 49 89 fc 53 48 83 ec 08 f6 80 47 e0 ff ff 04 74 04 <0f> 0b eb fe 81 80 44 e0 ff ff 00 00 01 04 65 ff 04 25 c4 0f 01 RIP [<ffffffff813e8e35>] do_nmi+0x22/0x1ee RSP <ffff88042fd47f28> ---[ end trace ed6752185092104b ]--- Kernel panic - not syncing: Fatal exception in interrupt Pid: 8611, comm: opcontrol Tainted: G D 2.6.39-00007-gfe47ae7 #1 Call Trace: <NMI> [<ffffffff813e5e0a>] panic+0x8c/0x188 [<ffffffff813e915c>] oops_end+0x81/0x8e [<ffffffff8100403d>] die+0x55/0x5e [<ffffffff813e8c45>] do_trap+0x11c/0x12b [<ffffffff810023c8>] do_invalid_op+0x91/0x9a [<ffffffff813e8e35>] ? do_nmi+0x22/0x1ee [<ffffffff8131e6fa>] ? oprofile_add_sample+0x83/0x95 [<ffffffff81321670>] ? op_amd_check_ctrs+0x4f/0x2cf [<ffffffff813ee4d5>] invalid_op+0x15/0x20 [<ffffffff813e8e35>] ? do_nmi+0x22/0x1ee [<ffffffff813e8e7a>] ? do_nmi+0x67/0x1ee [<ffffffff813e897a>] nmi+0x1a/0x20 [<ffffffff813f08ab>] ? bad_to_user+0x25/0x771 <<EOE>>
--- arch/x86/oprofile/backtrace.c | 46 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-)
arch/x86/oprofile/backtrace.c +42 -4
@@ -11,6 +11,8 @@#include <linux/oprofile.h> #include <linux/sched.h> #include <linux/mm.h> +#include <linux/highmem.h> +#include <asm/ptrace.h> #include <asm/uaccess.h> #include <asm/stacktrace.h>
@@ -48,6 +50,42 @@ static struct stacktrace_ops backtrace_ops = { .walk_stack = print_context_stack, }; +/* from arch/x86/kernel/cpu/perf_event.c: */ + +/* +* best effort, GUP based copy_from_user() that assumes IRQ or NMI context +*/ +static unsigned long +copy_from_user_nmi (void *to,const void __user *from,unsigned long n) +{ +unsigned long offset, addr = (unsigned long )from; +unsigned long size, len =0 ; +struct page *page; +void *map; +int ret; + +do { + ret =__get_user_pages_fast (addr,1 ,0 , &page); +if (!ret) +break ; + + offset = addr & (PAGE_SIZE -1 ); + size =min (PAGE_SIZE - offset, n - len); + + map =kmap_atomic (page,KM_USER0 ); +memcpy (to, map+offset, size); +kunmap_atomic (map,KM_USER0 ); +put_page (page); + + len += size; + to += size; + addr += size; + + }while (len < n); + +return len; +} +struct frame_head {struct frame_head *bp;unsigned long ret;
@@ -55,12 +93,12 @@ struct frame_head {static struct frame_head *dump_user_backtrace (struct frame_head *head) { +/* Also check accessibility of one struct frame_head beyond: */ struct frame_head bufhead[2 ]; +unsigned long bytes; -/* Also check accessibility of one struct frame_head beyond */ -if (!access_ok (VERIFY_READ , head,sizeof (bufhead))) -return NULL ; -if (__copy_from_user_inatomic (bufhead, head,sizeof (bufhead))) + bytes =copy_from_user_nmi (bufhead, head,sizeof (bufhead)); +if (bytes !=sizeof (bufhead))return NULL ;oprofile_add_trace (bufhead[0 ].ret);
Signature · 1 line
1.7.12.1
PATCH 57/77 ext4: avoid hangs in ext4_da_should_update_i_disksize()
In reply to Paul GortmakerFrom: Andrea Arcangeli <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit ea51d132dbf9b00063169c1159bee253d9649224 upstream.
If the pte mapping in generic_perform_write() is unmapped between iov_iter_fault_in_readable() and iov_iter_copy_from_user_atomic(), the "copied" parameter to ->end_write can be zero. ext4 couldn't cope with it with delayed allocations enabled. This skips the i_disksize enlargement logic if copied is zero and no new data was appeneded to the inode.
gdb> bt
#0 0xffffffff811afe80 in ext4_da_should_update_i_disksize (file=0xffff88003f606a80, mapping=0xffff88001d3824e0, pos=0x1\
08000, len=0x1000, copied=0x0, page=0xffffea0000d792e8, fsdata=0x0) at fs/ext4/inode.c:2467
#1 ext4_da_write_end (file=0xffff88003f606a80, mapping=0xffff88001d3824e0, pos=0x108000, len=0x1000, copied=0x0, page=0\
xffffea0000d792e8, fsdata=0x0) at fs/ext4/inode.c:2512
#2 0xffffffff810d97f1 in generic_perform_write (iocb=<value optimized out>, iov=<value optimized out>, nr_segs=<value o\
ptimized out>, pos=0x108000, ppos=0xffff88001e26be40, count=<value optimized out>, written=0x0) at mm/filemap.c:2440 #3 generic_file_buffered_write (iocb=<value optimized out>, iov=<value optimized out>, nr_segs=<value optimized out>, p\
os=0x108000, ppos=0xffff88001e26be40, count=<value optimized out>, written=0x0) at mm/filemap.c:2482 #4 0xffffffff810db5d1 in __generic_file_aio_write (iocb=0xffff88001e26bde8, iov=0xffff88001e26bec8, nr_segs=0x1, ppos=0\
xffff88001e26be40) at mm/filemap.c:2600
#5 0xffffffff810db853 in generic_file_aio_write (iocb=0xffff88001e26bde8, iov=0xffff88001e26bec8, nr_segs=<value optimi\
zed out>, pos=<value optimized out>) at mm/filemap.c:2632
#6 0xffffffff811a71aa in ext4_file_write (iocb=0xffff88001e26bde8, iov=0xffff88001e26bec8, nr_segs=0x1, pos=0x108000) a\
t fs/ext4/file.c:136
#7 0xffffffff811375aa in do_sync_write (filp=0xffff88003f606a80, buf=<value optimized out>, len=<value optimized out>, \
ppos=0xffff88001e26bf48) at fs/read_write.c:406
#8 0xffffffff81137e56 in vfs_write (file=0xffff88003f606a80, buf=0x1ec2960 <Address 0x1ec2960 out of bounds>, count=0x4\
000, pos=0xffff88001e26bf48) at fs/read_write.c:435
#9 0xffffffff8113816c in sys_write (fd=<value optimized out>, buf=0x1ec2960 <Address 0x1ec2960 out of bounds>, count=0x\
4000) at fs/read_write.c:487
#10 <signal handler called>
#11 0x00007f120077a390 in __brk_reservation_fn_dmi_alloc__ ()
#12 0x0000000000000000 in ?? ()
gdb> print offset
$22 = 0xffffffffffffffff
gdb> print idx
$23 = 0xffffffff
gdb> print inode->i_blkbits
$24 = 0xc
gdb> up
#1 ext4_da_write_end (file=0xffff88003f606a80, mapping=0xffff88001d3824e0, pos=0x108000, len=0x1000, copied=0x0, page=0\
xffffea0000d792e8, fsdata=0x0) at fs/ext4/inode.c:2512
2512 if (ext4_da_should_update_i_disksize(page, end)) {
gdb> print start
$25 = 0x0
gdb> print end
$26 = 0xffffffffffffffff
gdb> print pos
$27 = 0x108000
gdb> print new_i_size
$28 = 0x108000
gdb> print ((struct ext4_inode_info *)((char *)inode-((int)(&((struct ext4_inode_info *)0)->vfs_inode))))->i_disksize
$29 = 0xd9000
gdb> down
2467 for (i = 0; i < idx; i++)
gdb> print i
$30 = 0xd44acbeeThis is 100% reproducible with some autonuma development code tuned in a very aggressive manner (not normal way even for knumad) which does "exotic" changes to the ptes. It wouldn't normally trigger but I don't see why it can't happen normally if the page is added to swap cache in between the two faults leading to "copied" being zero (which then hangs in ext4). So it should be fixed. Especially possible with lumpy reclaim (albeit disabled if compaction is enabled) as that would ignore the young bits in the ptes.
--- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
@@ -3223,7 +3223,7 @@ static int ext4_da_write_end(struct file *file,*/ new_i_size = pos + copied; -if (new_i_size >EXT4_I (inode)->i_disksize) { +if (copied && new_i_size >EXT4_I (inode)->i_disksize) {if (ext4_da_should_update_i_disksize (page, end)) {down_write (&EXT4_I (inode)->i_data_sem);if (new_i_size >EXT4_I (inode)->i_disksize) {
Signature · 1 line
1.7.12.1
PATCH 58/77 USB: cdc-acm: add IDs for Motorola H24 HSPA USB module.
In reply to Paul GortmakerFrom: Krzysztof Hałasa <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 6abff5dc4d5a2c90e597137ce8987e7fd439259b upstream.
Add USB IDs for Motorola H24 HSPA USB module.
--- drivers/usb/class/cdc-acm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/usb/class/cdc-acm.c +10 -0
@@ -1545,6 +1545,16 @@ static const struct usb_device_id acm_ids[] = { }, {USB_DEVICE (0x22b8 ,0x6425 ),/* Motorola MOTOMAGX phones */ }, + /* Motorola H24 HSPA module: */ + { USB_DEVICE(0x22b8, 0x2d91) }, /* modem */ + { USB_DEVICE(0x22b8, 0x2d92) }, /* modem + diagnostics */ + { USB_DEVICE(0x22b8, 0x2d93) }, /* modem + AT port */ + { USB_DEVICE(0x22b8, 0x2d95) }, /* modem + AT port + diagnostics */ + { USB_DEVICE(0x22b8, 0x2d96) }, /* modem + NMEA */ + { USB_DEVICE(0x22b8, 0x2d97) }, /* modem + diagnostics + NMEA */ + { USB_DEVICE(0x22b8, 0x2d99) }, /* modem + AT port + NMEA */ + { USB_DEVICE(0x22b8, 0x2d9a) }, /* modem + AT port + diagnostics + NMEA */ + { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced ondata interface instead of
Signature · 1 line
1.7.12.1
PATCH 59/77 udf: Fortify loading of sparing table
In reply to Paul GortmakerFrom: Jan Kara <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 1df2ae31c724e57be9d7ac00d78db8a5dabdd050 upstream.
Add sanity checks when loading sparing table from disk to avoid accessing unallocated memory or writing to it.
--- fs/udf/super.c | 86 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 33 deletions(-)
fs/udf/super.c +53 -33
@@ -57,6 +57,7 @@#include <linux/seq_file.h> #include <linux/bitmap.h> #include <linux/crc-itu-t.h> +#include <linux/log2.h> #include <asm/byteorder.h> #include "udf_sb.h"
@@ -1239,11 +1240,59 @@ out_bh:return ret; } +static int udf_load_sparable_map (struct super_block *sb, +struct udf_part_map *map, +struct sparablePartitionMap *spm) +{ +uint32_t loc; +uint16_t ident; +struct sparingTable *st; +struct udf_sparing_data *sdata = &map->s_type_specific.s_sparing; +int i; +struct buffer_head *bh; + + map->s_partition_type =UDF_SPARABLE_MAP15 ; + sdata->s_packet_len =le16_to_cpu (spm->packetLength); +if (!is_power_of_2 (sdata->s_packet_len)) { +udf_error (sb,"error loading logical volume descriptor: " +"Invalid packet length %u\n" , + (unsigned )sdata->s_packet_len); +return -EIO ; + } +if (spm->numSparingTables >4 ) { +udf_error (sb,"error loading logical volume descriptor: " +"Too many sparing tables (%d)\n" , + (int )spm->numSparingTables); +return -EIO ; + } + +for (i =0 ; i < spm->numSparingTables; i++) { + loc =le32_to_cpu (spm->locSparingTable[i]); + bh =udf_read_tagged (sb, loc, loc, &ident); +if (!bh) +continue ; + + st = (struct sparingTable *)bh->b_data; +if (ident !=0 || +strncmp (st->sparingIdent.ident,UDF_ID_SPARING , +strlen (UDF_ID_SPARING )) || +sizeof (*st) +le16_to_cpu (st->reallocationTableLen) > + sb->s_blocksize) { +brelse (bh); +continue ; + } + + sdata->s_spar_map[i] = bh; + } + map->s_partition_func = udf_get_pblock_spar15; +return 0 ; +} +static int udf_load_logicalvol (struct super_block *sb,sector_t block,struct kernel_lb_addr *fileset) {struct logicalVolDesc *lvd; -int i, j, offset; +int i, offset;uint8_t type;struct udf_sb_info *sbi =UDF_SB (sb);struct genericPartitionMap *gpm;
@@ -1299,38 +1348,9 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, }else if (!strncmp (upm2->partIdent.ident,UDF_ID_SPARABLE ,strlen (UDF_ID_SPARABLE ))) { -uint32_t loc; -struct sparingTable *st; -struct sparablePartitionMap *spm = - (struct sparablePartitionMap *)gpm; - - map->s_partition_type =UDF_SPARABLE_MAP15 ; - map->s_type_specific.s_sparing.s_packet_len = -le16_to_cpu (spm->packetLength); -for (j =0 ; j < spm->numSparingTables; j++) { -struct buffer_head *bh2; - - loc =le32_to_cpu ( - spm->locSparingTable[j]); - bh2 =udf_read_tagged (sb, loc, loc, - &ident); - map->s_type_specific.s_sparing. - s_spar_map[j] = bh2; - -if (bh2 ==NULL ) -continue ; - - st = (struct sparingTable *)bh2->b_data; -if (ident !=0 ||strncmp ( - st->sparingIdent.ident, -UDF_ID_SPARING , -strlen (UDF_ID_SPARING ))) { -brelse (bh2); - map->s_type_specific.s_sparing. - s_spar_map[j] =NULL ; - } - } - map->s_partition_func = udf_get_pblock_spar15; +if (udf_load_sparable_map (sb, map, + (struct sparablePartitionMap *)gpm) <0 ) + goto out_bh; }else if (!strncmp (upm2->partIdent.ident,UDF_ID_METADATA ,strlen (UDF_ID_METADATA ))) {
Signature · 1 line
1.7.12.1
PATCH 60/77 udf: Avoid run away loop when partition table length is corrupted
In reply to Paul GortmakerFrom: Jan Kara <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit adee11b2085bee90bd8f4f52123ffb07882d6256 upstream.
Check provided length of partition table so that (possibly maliciously) corrupted partition table cannot cause accessing data beyond current buffer.
--- fs/udf/super.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/udf/super.c +9 -1
@@ -1298,6 +1298,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,struct genericPartitionMap *gpm;uint16_t ident;struct buffer_head *bh; +unsigned int table_len;int ret =0 ; bh =udf_read_tagged (sb, block, block, &ident);
@@ -1305,6 +1306,13 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,return 1 ;BUG_ON (ident !=TAG_IDENT_LVD ); lvd = (struct logicalVolDesc *)bh->b_data; + table_len =le32_to_cpu (lvd->mapTableLength); +if (sizeof (*lvd) + table_len > sb->s_blocksize) { +udf_error (sb,"error loading logical volume descriptor: " +"Partition table too long (%u > %lu)\n" , table_len, + sb->s_blocksize -sizeof (*lvd)); + goto out_bh; + } i =udf_sb_alloc_partition_maps (sb,le32_to_cpu (lvd->numPartitionMaps));if (i !=0 ) {
@@ -1313,7 +1321,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, }for (i =0 , offset =0 ; - i < sbi->s_partitions && offset <le32_to_cpu (lvd->mapTableLength); + i < sbi->s_partitions && offset < table_len; i++, offset += gpm->partitionMapLength) {struct udf_part_map *map = &sbi->s_partmaps[i]; gpm = (struct genericPartitionMap *)
Signature · 1 line
1.7.12.1
Re: [v2.6.34-stable 60/77] udf: Avoid run away loop when partition table length is corrupted
Quoted 8 lines · Paul Gortmaker
From: Jan Kara <[email protected]>
------------------- This is a commit scheduled for the next v2.6.34 longterm release. http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git If you see a problem with using this for longterm, please comment. -------------------
Quoted 8 lines
commit
adee11b2085bee90bd8f4f52123ffb07882d6256upstream.Check provided length of partition table so that (possibly maliciously) corrupted partition table cannot cause accessing data beyond current buffer.
Signed-off-by Jan Kara <[email protected]>[PG: in 2.6.34 udf_err() is called udf_error()]Signed-off-by Paul Gortmaker <[email protected]>
[...]
There's a follow-up I think you should add:
commit 57b9655d01ef057a523e810d29c37ac09b80eead
Author: Jan Kara <[email protected]> Date: Tue Jul 10 17:58:04 2012 +0200
udf: Improve table length check to avoid possible overflow
Ben.
Signature · 2 lines
Ben Hutchings If you seem to know what you are doing, you'll be given more to do.
Re: [v2.6.34-stable 60/77] udf: Avoid run away loop when partition table length is corrupted
Quoted 21 lines · Ben Hutchings
Quoted 8 lines · Paul Gortmaker
From: Jan Kara <[email protected]>
------------------- This is a commit scheduled for the next v2.6.34 longterm release. http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git If you see a problem with using this for longterm, please comment. -------------------Quoted 8 lines
commit
adee11b2085bee90bd8f4f52123ffb07882d6256upstream.Check provided length of partition table so that (possibly maliciously) corrupted partition table cannot cause accessing data beyond current buffer.
Signed-off-by Jan Kara <[email protected]>[PG: in 2.6.34 udf_err() is called udf_error()]Signed-off-by Paul Gortmaker <[email protected]>[...]
There's a follow-up I think you should add:
Quoted 7 lines
commit
57b9655d01ef057a523e810d29c37ac09b80eeadAuthor: Jan Kara <[email protected]> Date: Tue Jul 10 17:58:04 2012 +0200udf: Improve table length check to avoid possible overflow
Ben.
Thanks Ben for the review and the addition; I've queued this one as well.
Paul.
--
Quoted 1 line
PATCH 61/77 sctp: malloc enough room for asconf-ack chunk
In reply to Paul GortmakerFrom: Wei Yongjun <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 2cab86bee8e7f353e6ac8c15b3eb906643497644 upstream.
Sometime the ASCONF_ACK parameters can equal to the fourfold of ASCONF parameters, this only happend in some special case:
ASCONF parameter is :
Unrecognized Parameter (4 bytes)
ASCONF_ACK parameter should be:
Error Cause Indication parameter (8 bytes header)
+ Error Cause (4 bytes header)
+ Unrecognized Parameter (4bytes)
Four 4bytes Unrecognized Parameters in ASCONF chunk will cause panic.
Pid: 0, comm: swapper Not tainted 2.6.38-next+ #22 Bochs Bochs
EIP: 0060:[<c0717eae>] EFLAGS: 00010246 CPU: 0
EIP is at skb_put+0x60/0x70
EAX: 00000077 EBX: c09060e2 ECX: dec1dc30 EDX: c09469c0
ESI: 00000000 EDI: de3c8d40 EBP: dec1dc58 ESP: dec1dc2c
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Process swapper (pid: 0, ti=dec1c000 task=c09aef20 task.ti=c0980000)
Stack: c09469c0 e1894fa4 00000044 00000004 de3c8d00 de3c8d00 de3c8d44 de3c8d40 c09060e2 de25dd80 de3c8d40 dec1dc7c e1894fa4 dec1dcb0 00000040 00000004 00000000 00000800 00000004 00000004 dec1dce0 e1895a2b dec1dcb4 de25d960 Call Trace: [<e1894fa4>] ? sctp_addto_chunk+0x4e/0x89 [sctp] [<e1894fa4>] sctp_addto_chunk+0x4e/0x89 [sctp] [<e1895a2b>] sctp_process_asconf+0x32f/0x3d1 [sctp] [<e188d554>] sctp_sf_do_asconf+0xf8/0x173 [sctp] [<e1890b02>] sctp_do_sm+0xb8/0x159 [sctp] [<e18a2248>] ? sctp_cname+0x0/0x52 [sctp] [<e189392d>] sctp_assoc_bh_rcv+0xac/0xe3 [sctp] [<e1897d76>] sctp_inq_push+0x2d/0x30 [sctp] [<e18a21b2>] sctp_rcv+0x7a7/0x83d [sctp] [<c077a95c>] ? ipv4_confirm+0x118/0x125 [<c073a970>] ? nf_iterate+0x34/0x62 [<c074789d>] ? ip_local_deliver_finish+0x0/0x194 [<c074789d>] ? ip_local_deliver_finish+0x0/0x194 [<c0747992>] ip_local_deliver_finish+0xf5/0x194 [<c074789d>] ? ip_local_deliver_finish+0x0/0x194 [<c0747a6e>] NF_HOOK.clone.1+0x3d/0x44 [<c0747ab3>] ip_local_deliver+0x3e/0x44 [<c074789d>] ? ip_local_deliver_finish+0x0/0x194 [<c074775c>] ip_rcv_finish+0x29f/0x2c7 [<c07474bd>] ? ip_rcv_finish+0x0/0x2c7 [<c0747a6e>] NF_HOOK.clone.1+0x3d/0x44 [<c0747cae>] ip_rcv+0x1f5/0x233 [<c07474bd>] ? ip_rcv_finish+0x0/0x2c7 [<c071dce3>] __netif_receive_skb+0x310/0x336 [<c07221f3>] netif_receive_skb+0x4b/0x51 [<e0a4ed3d>] cp_rx_poll+0x1e7/0x29c [8139cp] [<c072275e>] net_rx_action+0x65/0x13a [<c0445a54>] __do_softirq+0xa1/0x149 [<c04459b3>] ? __do_softirq+0x0/0x149 <IRQ> [<c0445891>] ? irq_exit+0x37/0x72 [<c040a7e9>] ? do_IRQ+0x81/0x95 [<c07b3670>] ? common_interrupt+0x30/0x38 [<c0428058>] ? native_safe_halt+0xa/0xc [<c040f5d7>] ? default_idle+0x58/0x92 [<c0408fb0>] ? cpu_idle+0x96/0xb2 [<c0797989>] ? rest_init+0x5d/0x5f [<c09fd90c>] ? start_kernel+0x34b/0x350 [<c09fd0cb>] ? i386_start_kernel+0xba/0xc1
--- net/sctp/sm_make_chunk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sctp/sm_make_chunk.c +2 -2
@@ -3110,10 +3110,10 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,/* create an ASCONF_ACK chunk. * Based on the definitions of parameters, we know that the size of -* ASCONF_ACK parameters are less than or equal to the twice of ASCONF +* ASCONF_ACK parameters are less than or equal to the fourfold of ASCONF * parameters. */ - asconf_ack =sctp_make_asconf_ack (asoc, serial, chunk_len *2 ); + asconf_ack =sctp_make_asconf_ack (asoc, serial, chunk_len *4 );if (!asconf_ack) goto done;
Signature · 1 line
1.7.12.1
PATCH 62/77 sctp: Fix list corruption resulting from freeing an association on a list
In reply to Paul GortmakerFrom: Neil Horman <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 2eebc1e188e9e45886ee00662519849339884d6d upstream.
A few days ago Dave Jones reported this oops:
[22766.294255] general protection fault: 0000 [#1] PREEMPT SMP [22766.295376] CPU 0 [22766.295384] Modules linked in: [22766.387137] ffffffffa169f292 6b6b6b6b6b6b6b6b ffff880147c03a90 ffff880147c03a74 [22766.387135] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 00000000000 [22766.387136] Process trinity-watchdo (pid: 10896, threadinfo ffff88013e7d2000, [22766.387137] Stack: [22766.387140] ffff880147c03a10 [22766.387140] ffffffffa169f2b6 [22766.387140] ffff88013ed95728 [22766.387143] 0000000000000002 [22766.387143] 0000000000000000 [22766.387143] ffff880003fad062 [22766.387144] ffff88013c120000 [22766.387144] [22766.387145] Call Trace: [22766.387145] <IRQ> [22766.387150] [<ffffffffa169f292>] ? __sctp_lookup_association+0x62/0xd0 [sctp] [22766.387154] [<ffffffffa169f2b6>] __sctp_lookup_association+0x86/0xd0 [sctp] [22766.387157] [<ffffffffa169f597>] sctp_rcv+0x207/0xbb0 [sctp] [22766.387161] [<ffffffff810d4da8>] ? trace_hardirqs_off_caller+0x28/0xd0 [22766.387163] [<ffffffff815827e3>] ? nf_hook_slow+0x133/0x210 [22766.387166] [<ffffffff815902fc>] ? ip_local_deliver_finish+0x4c/0x4c0 [22766.387168] [<ffffffff8159043d>] ip_local_deliver_finish+0x18d/0x4c0 [22766.387169] [<ffffffff815902fc>] ? ip_local_deliver_finish+0x4c/0x4c0 [22766.387171] [<ffffffff81590a07>] ip_local_deliver+0x47/0x80 [22766.387172] [<ffffffff8158fd80>] ip_rcv_finish+0x150/0x680 [22766.387174] [<ffffffff81590c54>] ip_rcv+0x214/0x320 [22766.387176] [<ffffffff81558c07>] __netif_receive_skb+0x7b7/0x910 [22766.387178] [<ffffffff8155856c>] ? __netif_receive_skb+0x11c/0x910 [22766.387180] [<ffffffff810d423e>] ? put_lock_stats.isra.25+0xe/0x40 [22766.387182] [<ffffffff81558f83>] netif_receive_skb+0x23/0x1f0 [22766.387183] [<ffffffff815596a9>] ? dev_gro_receive+0x139/0x440 [22766.387185] [<ffffffff81559280>] napi_skb_finish+0x70/0xa0 [22766.387187] [<ffffffff81559cb5>] napi_gro_receive+0xf5/0x130 [22766.387218] [<ffffffffa01c4679>] e1000_receive_skb+0x59/0x70 [e1000e] [22766.387242] [<ffffffffa01c5aab>] e1000_clean_rx_irq+0x28b/0x460 [e1000e] [22766.387266] [<ffffffffa01c9c18>] e1000e_poll+0x78/0x430 [e1000e] [22766.387268] [<ffffffff81559fea>] net_rx_action+0x1aa/0x3d0 [22766.387270] [<ffffffff810a495f>] ? account_system_vtime+0x10f/0x130 [22766.387273] [<ffffffff810734d0>] __do_softirq+0xe0/0x420 [22766.387275] [<ffffffff8169826c>] call_softirq+0x1c/0x30 [22766.387278] [<ffffffff8101db15>] do_softirq+0xd5/0x110 [22766.387279] [<ffffffff81073bc5>] irq_exit+0xd5/0xe0 [22766.387281] [<ffffffff81698b03>] do_IRQ+0x63/0xd0 [22766.387283] [<ffffffff8168ee2f>] common_interrupt+0x6f/0x6f [22766.387283] <EOI> [22766.387284] [22766.387285] [<ffffffff8168eed9>] ? retint_swapgs+0x13/0x1b [22766.387285] Code: c0 90 5d c3 66 0f 1f 44 00 00 4c 89 c8 5d c3 0f 1f 00 55 48
89 e5 48 83
ec 20 48 89 5d e8 4c 89 65 f0 4c 89 6d f8 66 66 66 66 90 <0f> b7 87 98 00 00 00 48 89 fb
49 89 f5 66 c1 c0 08 66 39 46 02
[22766.387307] [22766.387307] RIP [22766.387311] [<ffffffffa168a2c9>] sctp_assoc_is_match+0x19/0x90 [sctp] [22766.387311] RSP <ffff880147c039b0> [22766.387142] ffffffffa16ab120 [22766.599537] ---[ end trace 3f6dae82e37b17f5 ]--- [22766.601221] Kernel panic - not syncing: Fatal exception in interrupt
It appears from his analysis and some staring at the code that this is likely occuring because an association is getting freed while still on the sctp_assoc_hashtable. As a result, we get a gpf when traversing the hashtable while a freed node corrupts part of the list.
Nominally I would think that an mibalanced refcount was responsible for this, but I can't seem to find any obvious imbalance. What I did note however was that the two places where we create an association using sctp_primitive_ASSOCIATE (__sctp_connect and sctp_sendmsg), have failure paths which free a newly created association after calling sctp_primitive_ASSOCIATE. sctp_primitive_ASSOCIATE brings us into the sctp_sf_do_prm_asoc path, which issues a SCTP_CMD_NEW_ASOC side effect, which in turn adds a new association to the aforementioned hash table. the sctp command interpreter that process side effects has not way to unwind previously processed commands, so freeing the association from the __sctp_connect or sctp_sendmsg error path would lead to a freed association remaining on this hash table.
I've fixed this but modifying sctp_[un]hash_established to use hlist_del_init, which allows us to proerly use hlist_unhashed to check if the node is on a hashlist safely during a delete. That in turn alows us to safely call sctp_unhash_established in the __sctp_connect and sctp_sendmsg error paths before freeing them, regardles of what the associations state is on the hash list.
I noted, while I was doing this, that the __sctp_unhash_endpoint was using hlist_unhsashed in a simmilar fashion, but never nullified any removed nodes pointers to make that function work properly, so I fixed that up in a simmilar fashion.
I attempted to test this using a virtual guest running the SCTP_RR test from netperf in a loop while running the trinity fuzzer, both in a loop. I wasn't able to recreate the problem prior to this fix, nor was I able to trigger the failure after (neither of which I suppose is suprising). Given the trace above however, I think its likely that this is what we hit.
--- net/sctp/input.c | 7 ++----- net/sctp/socket.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-)
net/sctp/input.c +2 -5
@@ -752,15 +752,12 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep) epb = &ep->base; -if (hlist_unhashed (&epb->node)) -return ; - epb->hashent =sctp_ep_hashfn (epb->bind_addr.port); head = &sctp_ep_hashtable[epb->hashent];sctp_write_lock (&head->lock); -__hlist_del (&epb->node); +hlist_del_init (&epb->node);sctp_write_unlock (&head->lock); }
@@ -841,7 +838,7 @@ static void __sctp_unhash_established(struct sctp_association *asoc) head = &sctp_assoc_hashtable[epb->hashent];sctp_write_lock (&head->lock); -__hlist_del (&epb->node); +hlist_del_init (&epb->node);sctp_write_unlock (&head->lock); }
net/sctp/socket.c +10 -2
@@ -1143,8 +1143,14 @@ out_free:SCTP_DEBUG_PRINTK ("About to exit __sctp_connect() free asoc: %p" " kaddrs: %p err: %d\n" , asoc, kaddrs, err); -if (asoc) +if (asoc) { +/* sctp_primitive_ASSOCIATE may have added this association +* To the hash table, try to unhash it, just in case, its a noop +* if it wasn't hashed so we're safe +*/ +sctp_unhash_established (asoc);sctp_association_free (asoc); + }return err; }
@@ -1852,8 +1858,10 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, goto out_unlock; out_free: -if (new_asoc) +if (new_asoc) { +sctp_unhash_established (asoc);sctp_association_free (asoc); + } out_unlock:sctp_release_sock (sk);
Signature · 1 line
1.7.12.1
PATCH 63/77 sctp: ABORT if receive, reassmbly, or reodering queue is not empty while closing socket
In reply to Paul GortmakerFrom: Thomas Graf <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit cd4fcc704f30f2064ab30b5300d44d431e46db50 upstream.
Trigger user ABORT if application closes a socket which has data queued on the socket receive queue or chunks waiting on the reassembly or ordering queue as this would imply data being lost which defeats the point of a graceful shutdown.
This behavior is already practiced in TCP.
We do not check the input queue because that would mean to parse all chunks on it to look for unacknowledged data which seems too much of an effort. Control chunks or duplicated chunks may also be in the input queue and should not be stopping a graceful shutdown.
--- include/net/sctp/ulpevent.h | 2 +- net/sctp/socket.c | 13 ++++++++----- net/sctp/ulpevent.c | 16 +++++++++++++--- 3 files changed, 22 insertions(+), 9 deletions(-)
include/net/sctp/ulpevent.h +1 -1
@@ -80,7 +80,7 @@ static inline struct sctp_ulpevent *sctp_skb2event(struct sk_buff *skb)void sctp_ulpevent_free (struct sctp_ulpevent *);int sctp_ulpevent_is_notification (const struct sctp_ulpevent *); -void sctp_queue_purge_ulpevents (struct sk_buff_head *list); +unsigned int sctp_queue_purge_ulpevents (struct sk_buff_head *list); struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( const struct sctp_association *asoc,
net/sctp/socket.c +8 -5
@@ -1373,6 +1373,7 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)struct sctp_endpoint *ep;struct sctp_association *asoc;struct list_head *pos, *temp; +unsigned int data_was_unread;SCTP_DEBUG_PRINTK ("sctp_close(sk: 0x%p, timeout:%ld)\n" , sk, timeout);
@@ -1382,6 +1383,10 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout) ep =sctp_sk (sk)->ep; +/* Clean up any skbs sitting on the receive queue. */ + data_was_unread =sctp_queue_purge_ulpevents (&sk->sk_receive_queue); + data_was_unread +=sctp_queue_purge_ulpevents (&sctp_sk (sk)->pd_lobby); +/* Walk all associations on an endpoint. */ list_for_each_safe (pos, temp, &ep->asocs) { asoc = list_entry(pos, struct sctp_association, asocs);
@@ -1399,7 +1404,9 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout) } } -if (sock_flag (sk,SOCK_LINGER ) && !sk->sk_lingertime) { +if (data_was_unread || !skb_queue_empty (&asoc->ulpq.lobby) || + !skb_queue_empty (&asoc->ulpq.reasm) || + (sock_flag (sk,SOCK_LINGER ) && !sk->sk_lingertime)) {struct sctp_chunk *chunk; chunk =sctp_make_abort_user (asoc,NULL ,0 );
@@ -1409,10 +1416,6 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)sctp_primitive_SHUTDOWN (asoc,NULL ); } -/* Clean up any skbs sitting on the receive queue. */ -sctp_queue_purge_ulpevents (&sk->sk_receive_queue); -sctp_queue_purge_ulpevents (&sctp_sk (sk)->pd_lobby); -/* On a TCP-style socket, block for at most linger_time if set. */ if (sctp_style (sk,TCP ) && timeout)sctp_wait_for_close (sk, timeout);
net/sctp/ulpevent.c +13 -3
@@ -1053,9 +1053,19 @@ void sctp_ulpevent_free(struct sctp_ulpevent *event) }/* Purge the skb lists holding ulpevents. */ -void sctp_queue_purge_ulpevents (struct sk_buff_head *list) +unsigned int sctp_queue_purge_ulpevents (struct sk_buff_head *list) {struct sk_buff *skb; -while ((skb =skb_dequeue (list)) !=NULL ) -sctp_ulpevent_free (sctp_skb2event (skb)); +unsigned int data_unread =0 ; + +while ((skb =skb_dequeue (list)) !=NULL ) { +struct sctp_ulpevent *event =sctp_skb2event (skb); + +if (!sctp_ulpevent_is_notification (event)) + data_unread += skb->len; + +sctp_ulpevent_free (event); + } + +return data_unread; }
Signature · 1 line
1.7.12.1
PATCH 64/77 sctp: Enforce retransmission limit during shutdown
In reply to Paul GortmakerFrom: Thomas Graf <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit f8d9605243280f1870dd2c6c37a735b925c15f3c upstream.
When initiating a graceful shutdown while having data chunks on the retransmission queue with a peer which is in zero window mode the shutdown is never completed because the retransmission error count is reset periodically by the following two rules:
- Do not timeout association while doing zero window probe.
- Reset overall error count when a heartbeat request has been acknowledged.
The graceful shutdown will wait for all outstanding TSN to be acknowledged before sending the SHUTDOWN request. This never happens due to the peer's zero window not acknowledging the continuously retransmitted data chunks. Although the error counter is incremented for each failed retransmission, the receiving of the SACK announcing the zero window clears the error count again immediately. Also heartbeat requests continue to be sent periodically. The peer acknowledges these requests causing the error counter to be reset as well.
This patch changes behaviour to only reset the overall error counter for the above rules while not in shutdown. After reaching the maximum number of retransmission attempts, the T5 shutdown guard timer is scheduled to give the receiver some additional time to recover. The timer is stopped as soon as the receiver acknowledges any data.
The issue can be easily reproduced by establishing a sctp association over the loopback device, constantly queueing data at the sender while not reading any at the receiver. Wait for the window to reach zero, then initiate a shutdown by killing both processes simultaneously. The association will never be freed and the chunks on the retransmission queue will be retransmitted indefinitely.
--- include/net/sctp/command.h | 1 + net/sctp/outqueue.c | 20 +++++++++++++++++++- net/sctp/sm_sideeffect.c | 20 ++++++++++++++++++-- net/sctp/sm_statefuns.c | 32 +++++++++++++++++++++++--------- net/sctp/sm_statetable.c | 2 +- 5 files changed, 62 insertions(+), 13 deletions(-)
include/net/sctp/command.h +1 -0
@@ -63,6 +63,7 @@ typedef enum {SCTP_CMD_ECN_ECNE ,/* Do delayed ECNE processing. */ SCTP_CMD_ECN_CWR ,/* Do delayed CWR processing. */ SCTP_CMD_TIMER_START ,/* Start a timer. */ +SCTP_CMD_TIMER_START_ONCE ,/* Start a timer once */ SCTP_CMD_TIMER_RESTART ,/* Restart a timer. */ SCTP_CMD_TIMER_STOP ,/* Stop a timer. */ SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */
net/sctp/outqueue.c +19 -1
@@ -1587,6 +1587,8 @@ static void sctp_check_transmitted(struct sctp_outq *q,#endif /* SCTP_DEBUG */ if (transport) {if (bytes_acked) { +struct sctp_association *asoc = transport->asoc; +/* We may have counted DATA that was migrated * to this transport due to DEL-IP operation. * Subtract those bytes, since the were never
@@ -1605,6 +1607,17 @@ static void sctp_check_transmitted(struct sctp_outq *q, transport->error_count =0 ; transport->asoc->overall_error_count =0 ; +/* +* While in SHUTDOWN PENDING, we may have started +* the T5 shutdown guard timer after reaching the +* retransmission limit. Stop that timer as soon +* as the receiver acknowledged any data. +*/ +if (asoc->state ==SCTP_STATE_SHUTDOWN_PENDING && +del_timer (&asoc->timers + [SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD ])) +sctp_association_put (asoc); +/* Mark the destination transport address as * active if it is not so marked. */
@@ -1634,10 +1647,15 @@ static void sctp_check_transmitted(struct sctp_outq *q,* A sender is doing zero window probing when the * receiver's advertised window is zero, and there is * only one data chunk in flight to the receiver. +* +* Allow the association to timeout while in SHUTDOWN +* PENDING or SHUTDOWN RECEIVED in case the receiver +* stays in zero window mode forever. */ if (!q->asoc->peer.rwnd && !list_empty (&tlist) && - (sack_ctsn+2 == q->asoc->next_tsn)) { + (sack_ctsn+2 == q->asoc->next_tsn) && + q->asoc->state <SCTP_STATE_SHUTDOWN_PENDING ) {SCTP_DEBUG_PRINTK ("%s: SACK received for zero " "window probe: %u\n" , __func__, sack_ctsn);
net/sctp/sm_sideeffect.c +18 -2
@@ -669,10 +669,19 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,/* 8.3 Upon the receipt of the HEARTBEAT ACK, the sender of the * HEARTBEAT should clear the error counter of the destination * transport address to which the HEARTBEAT was sent. -* The association's overall error count is also cleared. */ t->error_count =0 ; - t->asoc->overall_error_count =0 ; + +/* +* Although RFC4960 specifies that the overall error count must +* be cleared when a HEARTBEAT ACK is received, we make an +* exception while in SHUTDOWN PENDING. If the peer keeps its +* window shut forever, we may never be able to transmit our +* outstanding data and rely on the retransmission limit be reached +* to shutdown the association. +*/ +if (t->asoc->state !=SCTP_STATE_SHUTDOWN_PENDING ) + t->asoc->overall_error_count =0 ;/* Clear the hb_sent flag to signal that we had a good * acknowledgement.
@@ -1445,6 +1454,13 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,sctp_cmd_setup_t2 (commands, asoc, cmd->obj.ptr);break ; +case SCTP_CMD_TIMER_START_ONCE : + timer = &asoc->timers[cmd->obj.to]; + +if (timer_pending (timer)) +break ; +/* fall through */ +case SCTP_CMD_TIMER_START : timer = &asoc->timers[cmd->obj.to]; timeout = asoc->timeouts[cmd->obj.to];
net/sctp/sm_statefuns.c +23 -9
@@ -5099,7 +5099,7 @@ sctp_disposition_t sctp_sf_do_9_2_start_shutdown(* The sender of the SHUTDOWN MAY also start an overall guard timer * 'T5-shutdown-guard' to bound the overall time for shutdown sequence. */ -sctp_add_cmd_sf (commands,SCTP_CMD_TIMER_START , +sctp_add_cmd_sf (commands,SCTP_CMD_TIMER_RESTART ,SCTP_TO (SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD ));if (asoc->autoclose)
@@ -5244,14 +5244,28 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(const struct sctp_endpoint *ep,SCTP_INC_STATS (SCTP_MIB_T3_RTX_EXPIREDS );if (asoc->overall_error_count >= asoc->max_retrans) { -sctp_add_cmd_sf (commands,SCTP_CMD_SET_SK_ERR , -SCTP_ERROR (ETIMEDOUT )); -/* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ -sctp_add_cmd_sf (commands,SCTP_CMD_ASSOC_FAILED , -SCTP_PERR (SCTP_ERROR_NO_ERROR )); -SCTP_INC_STATS (SCTP_MIB_ABORTEDS ); -SCTP_DEC_STATS (SCTP_MIB_CURRESTAB ); -return SCTP_DISPOSITION_DELETE_TCB ; +if (asoc->state ==SCTP_STATE_SHUTDOWN_PENDING ) { +/* +* We are here likely because the receiver had its rwnd +* closed for a while and we have not been able to +* transmit the locally queued data within the maximum +* retransmission attempts limit. Start the T5 +* shutdown guard timer to give the receiver one last +* chance and some additional time to recover before +* aborting. +*/ +sctp_add_cmd_sf (commands,SCTP_CMD_TIMER_START_ONCE , +SCTP_TO (SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD )); + }else { +sctp_add_cmd_sf (commands,SCTP_CMD_SET_SK_ERR , +SCTP_ERROR (ETIMEDOUT )); +/* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ +sctp_add_cmd_sf (commands,SCTP_CMD_ASSOC_FAILED , +SCTP_PERR (SCTP_ERROR_NO_ERROR )); +SCTP_INC_STATS (SCTP_MIB_ABORTEDS ); +SCTP_DEC_STATS (SCTP_MIB_CURRESTAB ); +return SCTP_DISPOSITION_DELETE_TCB ; + } }/* E1) For the destination address for which the timer
net/sctp/sm_statetable.c +1 -1
@@ -897,7 +897,7 @@ static const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_/* SCTP_STATE_ESTABLISHED */ \TYPE_SCTP_FUNC (sctp_sf_timer_ignore), \/* SCTP_STATE_SHUTDOWN_PENDING */ \ -TYPE_SCTP_FUNC (sctp_sf_timer_ignore), \ +TYPE_SCTP_FUNC (sctp_sf_t5_timer_expire), \/* SCTP_STATE_SHUTDOWN_SENT */ \ TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \/* SCTP_STATE_SHUTDOWN_RECEIVED */ \
Signature · 1 line
1.7.12.1
PATCH 65/77 SCTP: fix race between sctp_bind_addr_free() and sctp_bind_addr_conflict()
In reply to Paul GortmakerFrom: Jacek Luczak <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit c182f90bc1f22ce5039b8722e45621d5f96862c2 upstream.
During the sctp_close() call, we do not use rcu primitives to destroy the address list attached to the endpoint. At the same time, we do the removal of addresses from this list before attempting to remove the socket from the port hash
As a result, it is possible for another process to find the socket in the port hash that is in the process of being closed. It then proceeds to traverse the address list to find the conflict, only to have that address list suddenly disappear without rcu() critical section.
Fix issue by closing address list removal inside RCU critical section.
Race can result in a kernel crash with general protection fault or kernel NULL pointer dereference:
kernel: general protection fault: 0000 [#1] SMP kernel: RIP: 0010:[<ffffffffa02f3dde>] [<ffffffffa02f3dde>] sctp_bind_addr_conflict+0x64/0x82 [sctp] kernel: Call Trace: kernel: [<ffffffffa02f415f>] ? sctp_get_port_local+0x17b/0x2a3 [sctp] kernel: [<ffffffffa02f3d45>] ? sctp_bind_addr_match+0x33/0x68 [sctp] kernel: [<ffffffffa02f4416>] ? sctp_do_bind+0xd3/0x141 [sctp] kernel: [<ffffffffa02f5030>] ? sctp_bindx_add+0x4d/0x8e [sctp] kernel: [<ffffffffa02f5183>] ? sctp_setsockopt_bindx+0x112/0x4a4 [sctp] kernel: [<ffffffff81089e82>] ? generic_file_aio_write+0x7f/0x9b kernel: [<ffffffffa02f763e>] ? sctp_setsockopt+0x14f/0xfee [sctp] kernel: [<ffffffff810c11fb>] ? do_sync_write+0xab/0xeb kernel: [<ffffffff810e82ab>] ? fsnotify+0x239/0x282 kernel: [<ffffffff810c2462>] ? alloc_file+0x18/0xb1 kernel: [<ffffffff8134a0b1>] ? compat_sys_setsockopt+0x1a5/0x1d9 kernel: [<ffffffff8134aaf1>] ? compat_sys_socketcall+0x143/0x1a4 kernel: [<ffffffff810467dc>] ? sysenter_dispatch+0x7/0x32
--- net/sctp/bind_addr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/sctp/bind_addr.c +4 -6
@@ -140,14 +140,12 @@ void sctp_bind_addr_init(struct sctp_bind_addr *bp, __u16 port)/* Dispose of the address list. */ static void sctp_bind_addr_clean (struct sctp_bind_addr *bp) { -struct sctp_sockaddr_entry *addr; -struct list_head *pos, *temp; +struct sctp_sockaddr_entry *addr, *temp;/* Empty the bind address list. */ -list_for_each_safe (pos, temp, &bp->address_list) { - addr = list_entry(pos, struct sctp_sockaddr_entry, list); -list_del (pos); -kfree (addr); +list_for_each_entry_safe (addr, temp, &bp->address_list, list) { +list_del_rcu (&addr->list); +call_rcu (&addr->rcu, sctp_local_addr_free);SCTP_DBG_OBJCNT_DEC (addr); } }
Signature · 1 line
1.7.12.1
PATCH 66/77 KVM: x86: Prevent starting PIT timers in the absence of irqchip support
In reply to Paul GortmakerFrom: Jan Kiszka <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 0924ab2cfa98b1ece26c033d696651fd62896c69 upstream.
User space may create the PIT and forgets about setting up the irqchips. In that case, firing PIT IRQs will crash the host:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000128 IP: [<ffffffffa10f6280>] kvm_set_irq+0x30/0x170 [kvm] ... Call Trace: [<ffffffffa11228c1>] pit_do_work+0x51/0xd0 [kvm] [<ffffffff81071431>] process_one_work+0x111/0x4d0 [<ffffffff81071bb2>] worker_thread+0x152/0x340 [<ffffffff81075c8e>] kthread+0x7e/0x90 [<ffffffff815a4474>] kernel_thread_helper+0x4/0x10
Prevent this by checking the irqchip mode before starting a timer. We can't deny creating the PIT if the irqchips aren't set up yet as current user land expects this order to work.
--- arch/x86/kvm/i8254.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/x86/kvm/i8254.c +7 -3
@@ -280,11 +280,15 @@ static struct kvm_timer_ops kpit_ops = { .is_periodic = kpit_is_periodic, }; -static void create_pit_timer (struct kvm_kpit_state *ps,u32 val,int is_period) +static void create_pit_timer (struct kvm *kvm,u32 val,int is_period) { +struct kvm_kpit_state *ps = &kvm->arch.vpit->pit_state;struct kvm_timer *pt = &ps->pit_timer;s64 interval; +if (!irqchip_in_kernel (kvm)) +return ; + interval =muldiv64 (val,NSEC_PER_SEC ,KVM_PIT_FREQ );pr_debug ("create pit timer, interval is %llu nsec\n" , interval);
@@ -336,13 +340,13 @@ static void pit_load_count(struct kvm *kvm, int channel, u32 val)/* FIXME: enhance mode 4 precision */ case 4 :if (!(ps->flags &KVM_PIT_FLAGS_HPET_LEGACY )) { -create_pit_timer (ps, val,0 ); +create_pit_timer (kvm, val,0 ); }break ;case 2 :case 3 :if (!(ps->flags &KVM_PIT_FLAGS_HPET_LEGACY )){ -create_pit_timer (ps, val,1 ); +create_pit_timer (kvm, val,1 ); }break ;default :
Signature · 1 line
1.7.12.1
PATCH 67/77 perf_events: Fix races in group composition
In reply to Paul GortmakerFrom: Peter Zijlstra <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 8a49542c0554af7d0073aac0ee73ee65b807ef34 upstream.
Group siblings don't pin each-other or the parent, so when we destroy events we must make sure to clean up all cross referencing pointers.
In particular, for destruction of a group leader we must be able to find all its siblings and remove their reference to it.
This means that detaching an event from its context must not detach it from the group, otherwise we can end up failing to clear all pointers.
Solve this by clearly separating the attachment to a context and attachment to a group, and keep the group composed until we destroy the events.
LKML-Reference: <new-submission>
--- include/linux/perf_event.h | 4 ++ kernel/perf_event.c | 91 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 71 insertions(+), 24 deletions(-)
include/linux/perf_event.h +4 -0
@@ -571,6 +571,9 @@ enum perf_group_flag { PERF_GROUP_SOFTWARE = 0x1, }; +#define PERF_ATTACH_CONTEXT 0x01 +#define PERF_ATTACH_GROUP 0x02 +/** * struct perf_event - performance event kernel representation: */
@@ -585,6 +588,7 @@ struct perf_event {const struct pmu *pmu;enum perf_event_active_state state; +unsigned int attach_state;atomic64_t count;/*
kernel/perf_event.c +67 -24
164 lines not on this page · raw message
Signature · 1 line
1.7.12.1
PATCH 68/77 perf: Fix tear-down of inherited group events
In reply to Paul GortmakerFrom: Peter Zijlstra <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 38b435b16c36b0d863efcf3f07b34a6fac9873fd upstream.
When destroying inherited events, we need to destroy groups too, otherwise the event iteration in perf_event_exit_task_context() will miss group siblings and we leak events with all the consequences.
LKML-Reference: <1300196470.2203.61.camel@twins>
--- kernel/perf_event.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
kernel/perf_event.c +8 -5
@@ -5196,17 +5196,20 @@ __perf_event_exit_task(struct perf_event *child_event, struct perf_event_context *child_ctx, struct task_struct *child) { - struct perf_event *parent_event; +if (child_event->parent) { +raw_spin_lock_irq (&child_ctx->lock); +perf_group_detach (child_event); +raw_spin_unlock_irq (&child_ctx->lock); + }perf_event_remove_from_context (child_event); - parent_event = child_event->parent;/* -* It can happen that parent exits first, and has events +* It can happen that the parent exits first, and has events * that are still around due to the child reference. These -* events need to be zapped - but otherwise linger. +* events need to be zapped. */ -if (parent_event) { +if (child_event->parent) {sync_child_event (child_event, child);free_event (child_event); }
Signature · 1 line
1.7.12.1
PATCH 69/77 sched: fix divide by zero at {thread_group,task}_times
In reply to Paul GortmakerFrom: Stanislaw Gruszka <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit bea6832cc8c4a0a9a65dd17da6aaa657fe27bc3e upstream.
On architectures where cputime_t is 64 bit type, is possible to trigger divide by zero on do_div(temp, (__force u32) total) line, if total is a non zero number but has lower 32 bit's zeroed. Removing casting is not a good solution since some do_div() implementations do cast to u32 internally.
This problem can be triggered in practice on very long lived processes:
PID: 2331 TASK: ffff880472814b00 CPU: 2 COMMAND: "oraagent.bin"
#0 [ffff880472a51b70] machine_kexec at ffffffff8103214b #1 [ffff880472a51bd0] crash_kexec at ffffffff810b91c2 #2 [ffff880472a51ca0] oops_end at ffffffff814f0b00 #3 [ffff880472a51cd0] die at ffffffff8100f26b #4 [ffff880472a51d00] do_trap at ffffffff814f03f4 #5 [ffff880472a51d60] do_divide_error at ffffffff8100cfff #6 [ffff880472a51e00] divide_error at ffffffff8100be7b
[exception RIP: thread_group_times+0x56]
RIP: ffffffff81056a16 RSP: ffff880472a51eb8 RFLAGS: 00010046
RAX: bc3572c9fe12d194 RBX: ffff880874150800 RCX: 0000000110266fad
RDX: 0000000000000000 RSI: ffff880472a51eb8 RDI: 001038ae7d9633dc
RBP: ffff880472a51ef8 R8: 00000000b10a3a64 R9: ffff880874150800
R10: 00007fcba27ab680 R11: 0000000000000202 R12: ffff880472a51f08
R13: ffff880472a51f10 R14: 0000000000000000 R15: 0000000000000007
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#7 [ffff880472a51f00] do_sys_times at ffffffff8108845d
#8 [ffff880472a51f40] sys_times at ffffffff81088524
#9 [ffff880472a51f80] system_call_fastpath at ffffffff8100b0f2
RIP: 0000003808caac3a RSP: 00007fcba27ab6d8 RFLAGS: 00000202
RAX: 0000000000000064 RBX: ffffffff8100b0f2 RCX: 0000000000000000
RDX: 00007fcba27ab6e0 RSI: 000000000076d58e RDI: 00007fcba27ab6e0
RBP: 00007fcba27ab700 R8: 0000000000000020 R9: 000000000000091b
R10: 00007fcba27ab680 R11: 0000000000000202 R12: 00007fff9ca41940
R13: 0000000000000000 R14: 00007fcba27ac9c0 R15: 00007fff9ca41940
ORIG_RAX: 0000000000000064 CS: 0033 SS: 002b[PG: sched/core.c is just sched.c in 2.6.34; also the do_div() on
__force u32 isn't explicitly seen since that is in v3.3-rc1~191^2~11]
--- kernel/sched.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
kernel/sched.c +20 -14
@@ -3410,6 +3410,20 @@ void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)# define nsecs_to_cputime (__nsecs) nsecs_to_jiffies(__nsecs)#endif +static cputime_t scale_utime (cputime_t utime,cputime_t rtime,cputime_t total) +{ +u64 temp = (__force u64 ) rtime; + + temp *= (__force u64 ) utime; + +if (sizeof (cputime_t) ==4 ) + temp =div_u64 (temp, (__force u32 ) total); +else + temp =div64_u64 (temp, (__force u64 ) total); + +return (__force cputime_t ) temp; +} +void task_times (struct task_struct *p,cputime_t *ut,cputime_t *st) {cputime_t rtime, utime = p->utime, total =cputime_add (utime, p->stime);
@@ -3419,13 +3433,9 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)*/ rtime =nsecs_to_cputime (p->se.sum_exec_runtime); -if (total) { -u64 temp = rtime; - - temp *= utime; -do_div (temp, total); - utime = (cputime_t )temp; - }else +if (total) + utime =scale_utime (utime, rtime, total); +else utime = rtime;/*
@@ -3452,13 +3462,9 @@ void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st) total =cputime_add (cputime.utime, cputime.stime); rtime =nsecs_to_cputime (cputime.sum_exec_runtime); -if (total) { -u64 temp = rtime; - - temp *= cputime.utime; -do_div (temp, total); - utime = (cputime_t )temp; - }else +if (total) + utime =scale_utime (cputime.utime, rtime, total); +else utime = rtime; sig->prev_utime =max (sig->prev_utime, utime);
Signature · 1 line
1.7.12.1
PATCH 70/77 mutex: Place lock in contended state after fastpath_lock failure
In reply to Paul GortmakerFrom: Will Deacon <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 0bce9c46bf3b15f485d82d7e81dabed6ebcc24b1 upstream.
ARM recently moved to asm-generic/mutex-xchg.h for its mutex implementation after the previous implementation was found to be missing some crucial memory barriers. However, this has revealed some problems running hackbench on SMP platforms due to the way in which the MUTEX_SPIN_ON_OWNER code operates.
The symptoms are that a bunch of hackbench tasks are left waiting on an unlocked mutex and therefore never get woken up to claim it. This boils down to the following sequence of events:
Task A Task B Task C Lock value
0 1 1 lock() 0 2 lock() 0 3 spin(A) 0 4 unlock() 1 5 lock() 0 6 cmpxchg(1,0) 0 7 contended() -1 8 lock() 0 9 spin(C) 0 10 unlock() 1 11 cmpxchg(1,0) 0 12 unlock() 1
At this point, the lock is unlocked, but Task B is in an uninterruptible sleep with nobody to wake it up.
This patch fixes the problem by ensuring we put the lock into the contended state if we fail to acquire it on the fastpath, ensuring that any blocked waiters are woken up when the mutex is released.
--- include/asm-generic/mutex-xchg.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
include/asm-generic/mutex-xchg.h +9 -2
@@ -26,7 +26,13 @@ static inline void __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) {if (unlikely (atomic_xchg (count,0 ) !=1 )) -fail_fn (count); +/* +* We failed to acquire the lock, so mark it contended +* to ensure that any waiting tasks are woken up by the +* unlock slow path. +*/ +if (likely (atomic_xchg (count,-1 ) !=1 )) +fail_fn (count); }/**
@@ -43,7 +49,8 @@ static inline int __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) {if (unlikely (atomic_xchg (count,0 ) !=1 )) -return fail_fn (count); +if (likely (atomic_xchg (count,-1 ) !=1 )) +return fail_fn (count);return 0 ; }
Signature · 1 line
1.7.12.1
PATCH 71/77 crypto: ghash - Avoid null pointer dereference if no key is set
In reply to Paul GortmakerFrom: Nick Bowler <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 7ed47b7d142ec99ad6880bbbec51e9f12b3af74c upstream.
The ghash_update function passes a pointer to gf128mul_4k_lle which will be NULL if ghash_setkey is not called or if the most recent call to ghash_setkey failed to allocate memory. This causes an oops. Fix this up by returning an error code in the null case.
This is trivially triggered from unprivileged userspace through the AF_ALG interface by simply writing to the socket without setting a key.
The ghash_final function has a similar issue, but triggering it requires a memory allocation failure in ghash_setkey _after_ at least one successful call to ghash_update.
BUG: unable to handle kernel NULL pointer dereference at 00000670 IP: [<d88c92d4>] gf128mul_4k_lle+0x23/0x60 [gf128mul] *pde = 00000000 Oops: 0000 [#1] PREEMPT SMP Modules linked in: ghash_generic gf128mul algif_hash af_alg nfs lockd nfs_acl sunrpc bridge ipv6 stp llc
Pid: 1502, comm: hashatron Tainted: G W 3.1.0-rc9-00085-ge9308cf #32 Bochs Bochs
EIP: 0060:[<d88c92d4>] EFLAGS: 00000202 CPU: 0
EIP is at gf128mul_4k_lle+0x23/0x60 [gf128mul]
EAX: d69db1f0 EBX: d6b8ddac ECX: 00000004 EDX: 00000000
ESI: 00000670 EDI: d6b8ddac EBP: d6b8ddc8 ESP: d6b8dda4
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process hashatron (pid: 1502, ti=d6b8c000 task=d6810000 task.ti=d6b8c000)
Stack: 00000000 d69db1f0 00000163 00000000 d6b8ddc8 c101a520 d69db1f0 d52aa000 00000ff0 d6b8dde8 d88d310f d6b8a3f8 d52aa000 00001000 d88d502c d6b8ddfc 00001000 d6b8ddf4 c11676ed d69db1e8 d6b8de24 c11679ad d52aa000 00000000 Call Trace: [<c101a520>] ? kmap_atomic_prot+0x37/0xa6 [<d88d310f>] ghash_update+0x85/0xbe [ghash_generic] [<c11676ed>] crypto_shash_update+0x18/0x1b [<c11679ad>] shash_ahash_update+0x22/0x36 [<c11679cc>] shash_async_update+0xb/0xd [<d88ce0ba>] hash_sendpage+0xba/0xf2 [algif_hash] [<c121b24c>] kernel_sendpage+0x39/0x4e [<d88ce000>] ? 0xd88cdfff [<c121b298>] sock_sendpage+0x37/0x3e [<c121b261>] ? kernel_sendpage+0x4e/0x4e [<c10b4dbc>] pipe_to_sendpage+0x56/0x61 [<c10b4e1f>] splice_from_pipe_feed+0x58/0xcd [<c10b4d66>] ? splice_from_pipe_begin+0x10/0x10 [<c10b51f5>] __splice_from_pipe+0x36/0x55 [<c10b4d66>] ? splice_from_pipe_begin+0x10/0x10 [<c10b6383>] splice_from_pipe+0x51/0x64 [<c10b63c2>] ? default_file_splice_write+0x2c/0x2c [<c10b63d5>] generic_splice_sendpage+0x13/0x15 [<c10b4d66>] ? splice_from_pipe_begin+0x10/0x10 [<c10b527f>] do_splice_from+0x5d/0x67 [<c10b6865>] sys_splice+0x2bf/0x363 [<c129373b>] ? sysenter_exit+0xf/0x16 [<c104dc1e>] ? trace_hardirqs_on_caller+0x10e/0x13f [<c129370c>] sysenter_do_call+0x12/0x32 Code: 83 c4 0c 5b 5e 5f c9 c3 55 b9 04 00 00 00 89 e5 57 8d 7d e4 56 53 8d 5d e4 83 ec 18 89 45 e0 89 55 dc 0f b6 70 0f c1 e6 04 01 d6 <f3> a5 be 0f 00 00 00 4e 89 d8 e8 48 ff ff ff 8b 45 e0 89 da 0f EIP: [<d88c92d4>] gf128mul_4k_lle+0x23/0x60 [gf128mul] SS:ESP 0068:d6b8dda4 CR2: 0000000000000670 ---[ end trace 4eaa2a86a8e2da24 ]--- note: hashatron[1502] exited with preempt_count 1 BUG: scheduling while atomic: hashatron/1502/0x10000002 INFO: lockdep is turned off. [...]
--- crypto/ghash-generic.c | 6 ++++++ 1 file changed, 6 insertions(+)
crypto/ghash-generic.c +6 -0
@@ -67,6 +67,9 @@ static int ghash_update(struct shash_desc *desc,struct ghash_ctx *ctx =crypto_shash_ctx (desc->tfm);u8 *dst = dctx->buffer; +if (!ctx->gf128) +return -ENOKEY ; +if (dctx->bytes) {int n =min (srclen, dctx->bytes);u8 *pos = dst + (GHASH_BLOCK_SIZE - dctx->bytes);
@@ -119,6 +122,9 @@ static int ghash_final(struct shash_desc *desc, u8 *dst)struct ghash_ctx *ctx =crypto_shash_ctx (desc->tfm);u8 *buf = dctx->buffer; +if (!ctx->gf128) +return -ENOKEY ; +ghash_flush (ctx, dctx);memcpy (dst, buf,GHASH_BLOCK_SIZE );
Signature · 1 line
1.7.12.1
Re: [v2.6.34-stable 71/77] crypto: ghash - Avoid null pointer dereference if no key is set
Quoted 10 lines · Paul Gortmaker
From: Nick Bowler <[email protected]>
------------------- This is a commit scheduled for the next v2.6.34 longterm release. http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git If you see a problem with using this for longterm, please comment. -------------------commit
7ed47b7d142ec99ad6880bbbec51e9f12b3af74cupstream.
Quoted 7 lines
The
ghash_updatefunction passes a pointer togf128mul_4k_llewhich will be NULL ifghash_setkeyis not called or if the most recent call toghash_setkeyfailed to allocate memory. This causes an oops. Fix this up by returning an error code in the null case.This is trivially triggered from unprivileged userspace through the
AF_ALGinterface by simply writing to the socket without setting a key.
I haven't been following 2.6.34-longterm development, but unless you've also backported the AF_ALG userspace interface from 2.6.38, this sequence can only be triggered by kernel code. So while this patch shouldn't break anything, it isn't really necessary.
Cheers,
Signature · 1 line
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
Re: [v2.6.34-stable 71/77] crypto: ghash - Avoid null pointer dereference if no key is set
Quoted 16 lines · Nick Bowler
Quoted 15 lines · Paul Gortmaker
From: Nick Bowler <[email protected]>
------------------- This is a commit scheduled for the next v2.6.34 longterm release. http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git If you see a problem with using this for longterm, please comment. -------------------commit
7ed47b7d142ec99ad6880bbbec51e9f12b3af74cupstream.The
ghash_updatefunction passes a pointer togf128mul_4k_llewhich will be NULL ifghash_setkeyis not called or if the most recent call toghash_setkeyfailed to allocate memory. This causes an oops. Fix this up by returning an error code in the null case.
Quoted 7 lines
Quoted 2 lines
This is trivially triggered from unprivileged userspace through the
AF_ALGinterface by simply writing to the socket without setting a key.I haven't been following 2.6.34-longterm development, but unless you've also backported the
AF_ALGuserspace interface from 2.6.38, this sequence can only be triggered by kernel code. So while this patch shouldn't break anything, it isn't really necessary.
We've not backported any features or interfaces, as doing so is generally outside of the mandate of what -stable tries to achieve. So I'll simply drop the patch.
Thanks for the info.
Paul
--
Quoted 3 lines
Cheers,
PATCH 72/77 net: Fix ip link add netns oops
In reply to Paul GortmakerFrom: "Eric W. Biederman" <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 13ad17745c2cbd437d9e24b2d97393e0be11c439 upstream.
Quoted 53 lines · Ed Swierk
On 2.6.35.7
ip link add link eth0 netns 9999 type macvlan
where 9999 is a nonexistent PID triggers an oops and causes all network functions to hang:[10663.821898] BUG: unable to handle kernel NULL pointer dereference at 000000000000006d [10663.821917] IP: [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170 [10663.821933] PGD 1d3927067 PUD 22f5c5067 PMD 0 [10663.821944] Oops: 0000 [#1] SMP [10663.821953] last sysfs file: /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq [10663.821959] CPU 3 [10663.821963] Modules linked in: macvlan ip6table_filter ip6_tables rfcomm ipt_MASQUERADE binfmt_misc iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack sco ipt_REJECT bnep l2cap xt_tcpudp iptable_filter ip_tables x_tables bridge stp vboxnetadp vboxnetflt vboxdrv kvm_intel kvm parport_pc ppdev snd_hda_codec_intelhdmi snd_hda_codec_conexant arc4 iwlagn iwlcore mac80211 snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_midi snd_rawmidi i915 snd_seq_midi_event snd_seq thinkpad_acpi drm_kms_helper btusb tpm_tis nvram uvcvideo snd_timer snd_seq_device bluetooth videodev v4l1_compat v4l2_compat_ioctl32 tpm drm tpm_bios snd cfg80211 psmouse serio_raw intel_ips soundcore snd_page_alloc intel_agp i2c_algo_bit video output netconsole configfs lp parport usbhid hid e1000e sdhci_pci ahci libahci sdhci led_class [10663.822155] [10663.822161] Pid: 6000, comm: ip Not tainted 2.6.35-23-generic #41-Ubuntu 2901CTO/2901CTO [10663.822167] RIP: 0010:[<ffffffff8149c2fa>] [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170 [10663.822177] RSP: 0018:ffff88014aebf7b8 EFLAGS: 00010286 [10663.822182] RAX: 00000000fffffff4 RBX: ffff8801ad900800 RCX: 0000000000000000 [10663.822187] RDX: ffff880000000000 RSI: 0000000000000000 RDI: ffff88014ad63000 [10663.822191] RBP: ffff88014aebf808 R08: 0000000000000041 R09: 0000000000000041 [10663.822196] R10: 0000000000000000 R11: dead000000200200 R12: ffff88014aebf818 [10663.822201] R13: fffffffffffffffd R14: ffff88014aebf918 R15: ffff88014ad62000 [10663.822207] FS: 00007f00c487f700(0000) GS:ffff880001f80000(0000) knlGS:0000000000000000 [10663.822212] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [10663.822216] CR2: 000000000000006d CR3: 0000000231f19000 CR4: 00000000000026e0 [10663.822221] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [10663.822226] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [10663.822231] Process ip (pid: 6000, threadinfo ffff88014aebe000, task ffff88014afb16e0) [10663.822236] Stack: [10663.822240] ffff88014aebf808 ffffffff814a2bb5 ffff88014aebf7e8 00000000a00ee8d6 [10663.822251] <0> 0000000000000000 ffffffffa00ef940 ffff8801ad900800 ffff88014aebf818 [10663.822265] <0> ffff88014aebf918 ffff8801ad900800 ffff88014aebf858 ffffffff8149c413 [10663.822281] Call Trace: [10663.822290] [<ffffffff814a2bb5>] ? dev_addr_init+0x75/0xb0 [10663.822298] [<ffffffff8149c413>] dev_alloc_name+0x43/0x90 [10663.822307] [<ffffffff814a85ee>] rtnl_create_link+0xbe/0x1b0 [10663.822314] [<ffffffff814ab2aa>] rtnl_newlink+0x48a/0x570 [10663.822321] [<ffffffff814aafcc>] ? rtnl_newlink+0x1ac/0x570 [10663.822332] [<ffffffff81030064>] ? native_x2apic_icr_read+0x4/0x20 [10663.822339] [<ffffffff814a8c17>] rtnetlink_rcv_msg+0x177/0x290 [10663.822346] [<ffffffff814a8aa0>] ? rtnetlink_rcv_msg+0x0/0x290 [10663.822354] [<ffffffff814c25d9>] netlink_rcv_skb+0xa9/0xd0 [10663.822360] [<ffffffff814a8a85>] rtnetlink_rcv+0x25/0x40 [10663.822367] [<ffffffff814c223e>] netlink_unicast+0x2de/0x2f0 [10663.822374] [<ffffffff814c303e>] netlink_sendmsg+0x1fe/0x2e0 [10663.822383] [<ffffffff81488533>] sock_sendmsg+0xf3/0x120 [10663.822391] [<ffffffff815899fe>] ? _raw_spin_lock+0xe/0x20 [10663.822400] [<ffffffff81168656>] ? __d_lookup+0x136/0x150 [10663.822406] [<ffffffff815899fe>] ? _raw_spin_lock+0xe/0x20 [10663.822414] [<ffffffff812b7a0d>] ? _atomic_dec_and_lock+0x4d/0x80 [10663.822422] [<ffffffff8116ea90>] ? mntput_no_expire+0x30/0x110 [10663.822429] [<ffffffff81486ff5>] ? move_addr_to_kernel+0x65/0x70 [10663.822435] [<ffffffff81493308>] ? verify_iovec+0x88/0xe0 [10663.822442] [<ffffffff81489020>] sys_sendmsg+0x240/0x3a0 [10663.822450] [<ffffffff8111e2a9>] ? __do_fault+0x479/0x560 [10663.822457] [<ffffffff815899fe>] ? _raw_spin_lock+0xe/0x20
Quoted 8 lines
[10663.822465] [<ffffffff8116cf4a>] ? alloc_fd+0x10a/0x150 [10663.822473] [<ffffffff8158d76e>] ? do_page_fault+0x15e/0x350 [10663.822482] [<ffffffff8100a0f2>] system_call_fastpath+0x16/0x1b [10663.822487] Code: 90 48 8d 78 02 be 25 00 00 00 e8 92 1d e2 ff 48 85 c0 75 cf bf 20 00 00 00 e8 c3 b1 c6 ff 49 89 c7 b8 f4 ff ff ff 4d 85 ff 74 bd <4d> 8b 75 70 49 8d 45 70 48 89 45 b8 49 83 ee 58 eb 28 48 8d 55 [10663.822618] RIP [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170 [10663.822627] RSP <ffff88014aebf7b8> [10663.822631] CR2: 000000000000006d [10663.822636] ---[ end trace 3dfd6c3ad5327ca7 ]---
This bug was introduced in:
commit 81adee47dfb608df3ad0b91d230fb3cef75f0060
Author: Eric W. Biederman <[email protected]> Date: Sun Nov 8 00:53:51 2009 -0800
net: Support specifying the network namespace upon device creation.
There is no good reason to not support userspace specifying the network namespace during device creation, and it makes it easier to create a network device and pass it to a child network namespace with a well known name.
We have to be careful to ensure that the target network namespace for the new device exists through the life of the call. To keep that logic clear I have factored out the network namespace grabbing logic into rtnl_link_get_net.
In addtion we need to continue to pass the source network namespace to the rtnl_link_ops.newlink method so that we can find the base device source network namespace.
Where apparently I forgot to add error handling to the path where we create a new network device in a new network namespace, and pass in an invalid pid.
--- net/core/rtnetlink.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/rtnetlink.c +3 -0
@@ -1324,6 +1324,9 @@ replay:snprintf (ifname,IFNAMSIZ ,"%s%%d" , ops->kind); dest_net =rtnl_link_get_net (net, tb); +if (IS_ERR (dest_net)) +return PTR_ERR (dest_net); + dev =rtnl_create_link (net, dest_net, ifname, ops, tb);if (IS_ERR (dev))
Signature · 1 line
1.7.12.1
PATCH 73/77 sched/rt: Fix task stack corruption under __ARCH_WANT_INTERRUPTS_ON_CTXSW
In reply to Paul GortmakerFrom: Chanho Min <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit cb297a3e433dbdcf7ad81e0564e7b804c941ff0d upstream.
This issue happens under the following conditions:
1. preemption is off
2. __ARCH_WANT_INTERRUPTS_ON_CTXSW is defined
3. RT scheduling class
4. SMP system
Sequence is as follows:
1.suppose current task is A. start schedule() 2.task A is enqueued pushable task at the entry of schedule()
__schedule
prev = rq->curr;
...
put_prev_task
put_prev_task_rt
enqueue_pushable_task
4.pick the task B as next task.
next = pick_next_task(rq);
3.rq->curr set to task B and context_switch is started.
rq->curr = next;
4.At the entry of context_swtich, release this cpu's rq->lock.
context_switch
prepare_task_switch
prepare_lock_switch
raw_spin_unlock_irq(&rq->lock);
5.Shortly after rq->lock is released, interrupt is occurred and start IRQ context
6.try_to_wake_up() which called by ISR acquires rq->lock
try_to_wake_up
ttwu_remote
rq = __task_rq_lock(p)
ttwu_do_wakeup(rq, p, wake_flags);
task_woken_rt
7.push_rt_task picks the task A which is enqueued before.
task_woken_rt
push_rt_tasks(rq)
next_task = pick_next_pushable_task(rq)
8.At find_lock_lowest_rq(), If double_lock_balance() returns 0,
lowest_rq can be the remote rq.
(But,If preemption is on, double_lock_balance always return 1 and it
does't happen.)
push_rt_task
find_lock_lowest_rq
if (double_lock_balance(rq, lowest_rq))..
9.find_lock_lowest_rq return the available rq. task A is migrated to
the remote cpu/rq.
push_rt_task
...
deactivate_task(rq, next_task, 0);
set_task_cpu(next_task, lowest_rq->cpu);
activate_task(lowest_rq, next_task, 0); 10. But, task A is on irq context at this cpu.
So, task A is scheduled by two cpus at the same time until restore from IRQ. Task A's stack is corrupted.
To fix it, don't migrate an RT task if it's still running.
--- kernel/sched_rt.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/sched_rt.c +5 -0
@@ -1315,6 +1315,11 @@ static int push_rt_task(struct rq *rq)if (!next_task)return 0 ; +#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW +if (unlikely (task_running (rq, next_task))) +return 0 ; +#endif + retry:if (unlikely (next_task == rq->curr)) {WARN_ON (1 );
Signature · 1 line
1.7.12.1
PATCH 74/77 rwsem: Remove redundant asmregparm annotation
In reply to Paul GortmakerFrom: Thomas Gleixner <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit d123375425d7df4b6081a631fc1203fceafa59b2 upstream.
Peter Zijlstra pointed out, that the only user of asmregparm (x86) is compiling the kernel already with -mregparm=3. So the annotation of the rwsem functions is redundant. Remove it.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/rwsem.h | 12 ++++-------- lib/rwsem.c | 10 ++++------ 2 files changed, 8 insertions(+), 14 deletions(-)
arch/x86/include/asm/rwsem.h +4 -8
@@ -45,14 +45,10 @@struct rwsem_waiter ; -extern asmregparm struct rw_semaphore * -rwsem_down_read_failed (struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore * -rwsem_down_write_failed (struct rw_semaphore *sem); -extern asmregparm struct rw_semaphore * -rwsem_wake (struct rw_semaphore *); -extern asmregparm struct rw_semaphore * -rwsem_downgrade_wake (struct rw_semaphore *sem); +extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem); +extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem); +extern struct rw_semaphore *rwsem_wake (struct rw_semaphore *); +extern struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem);/* * the semaphore definition
lib/rwsem.c +4 -6
@@ -188,8 +188,7 @@ rwsem_down_failed_common(struct rw_semaphore *sem,/* * wait for the read lock to be granted */ -asmregparm struct rw_semaphore __sched * -rwsem_down_read_failed (struct rw_semaphore *sem) +struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem) {struct rwsem_waiter waiter;
@@ -202,8 +201,7 @@ rwsem_down_read_failed(struct rw_semaphore *sem)/* * wait for the write lock to be granted */ -asmregparm struct rw_semaphore __sched * -rwsem_down_write_failed (struct rw_semaphore *sem) +struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem) {struct rwsem_waiter waiter;
@@ -217,7 +215,7 @@ rwsem_down_write_failed(struct rw_semaphore *sem)* handle waking up a waiter on the semaphore * - up_read/up_write has decremented the active part of count if we come here */ -asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem) +struct rw_semaphore *rwsem_wake (struct rw_semaphore *sem) {unsigned long flags;
@@ -237,7 +235,7 @@ asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)* - caller incremented waiting part of count and discovered it still negative * - just wake up any readers at the front of the queue */ -asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem) +struct rw_semaphore *rwsem_downgrade_wake (struct rw_semaphore *sem) {unsigned long flags;
Signature · 1 line
1.7.12.1
PATCH 75/77 um: Use RWSEM_GENERIC_SPINLOCK on x86
In reply to Paul GortmakerFrom: Richard Weinberger <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 3a3679078aed2c451ebc32836bbd3b8219a65e01 upstream.
Commit d12337 (rwsem: Remove redundant asmregparm annotation) broke rwsem on UML.
As we cannot compile UML with -mregparm=3 and keeping asmregparm only for UML is inadequate the easiest solution is using RWSEM_GENERIC_SPINLOCK.
Thanks to Thomas Gleixner for the idea.
--- arch/um/Kconfig.x86 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/Kconfig.x86 +2 -2
@@ -20,10 +20,10 @@ config X86_32 select HAVE_AOUT config RWSEM_XCHGADD_ALGORITHM - def_bool X86_XADD + def_bool X86_XADD && 64BIT config RWSEM_GENERIC_SPINLOCK - def_bool !X86_XADD + def_bool !RWSEM_XCHGADD_ALGORITHM config 3_LEVEL_PGTABLES bool "Three-level pagetables (EXPERIMENTAL)" if !64BIT
Signature · 7 lines
1.7.12.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
PATCH 76/77 x86: Get rid of asmregparm
In reply to Paul GortmakerFrom: Richard Weinberger <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 1b4ac2a935aaf194241a2f4165d6407ba9650e1a upstream.
As UML does no longer need asmregparm we can remove it.
--- arch/x86/include/asm/linkage.h | 5 ----- arch/x86/kernel/ptrace.c | 4 ++-- include/linux/linkage.h | 4 ---- 3 files changed, 2 insertions(+), 11 deletions(-)
arch/x86/include/asm/linkage.h +0 -5
@@ -8,11 +8,6 @@#ifdef CONFIG_X86_32 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) -/* -* For 32-bit UML - mark functions implemented in assembly that use -* regparm input parameters: -*/ -#define asmregparm __attribute__((regparm(3)))/* * Make sure the compiler doesn't do anything stupid with the
arch/x86/kernel/ptrace.c +2 -2
@@ -1730,7 +1730,7 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,* We must return the syscall number to actually look up in the table. * This can be -1L to skip running any syscall at all. */ -asmregparm long syscall_trace_enter (struct pt_regs *regs) +long syscall_trace_enter (struct pt_regs *regs) {long ret =0 ;
@@ -1775,7 +1775,7 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs)return ret ?: regs->orig_ax; } -asmregparm void syscall_trace_leave(struct pt_regs *regs) +void syscall_trace_leave (struct pt_regs *regs) {bool step;
include/linux/linkage.h +0 -4
@@ -14,10 +14,6 @@#define asmlinkage CPP_ASMLINKAGE#endif -#ifndef asmregparm -# define asmregparm -#endif -#define __page_aligned_data __section(.data.page_aligned) __aligned(PAGE_SIZE)#define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE)
Signature · 1 line
1.7.12.1
PATCH 77/77 x86: Don't use the EFI reboot method by default
In reply to Paul GortmakerFrom: Matthew Garrett <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit f70e957cda22d309c769805cbb932407a5232219 upstream.
Testing suggests that at least some Lenovos and some Intels will fail to reboot via EFI, attempting to jump to an unmapped physical address. In the long run we could handle this by providing a page table with a 1:1 mapping of physical addresses, but for now it's probably just easier to assume that ACPI or legacy methods will be present and reboot via those.
--- arch/x86/kernel/efi.c | 3 --- 1 file changed, 3 deletions(-)
arch/x86/kernel/efi.c +0 -3
@@ -459,9 +459,6 @@ void __init efi_init(void) x86_platform.set_wallclock = efi_set_rtc_mmss;#endif -/* Setup for EFI runtime service */ - reboot_type =BOOT_EFI ; -#if EFI_DEBUG print_efi_memmap ();#endif
Signature · 1 line
1.7.12.1