3.0.50-stable review
Subsystems (26)
Greg Kroah-Hartman
maintainercover 3.0.50-stable review
This is the start of the stable review cycle for the 3.0.50 release. There are 34 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 me know.
Responses should be made by Wed Oct 31 20:03:41 UTC 2012. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.50-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Sjoerd Simons <[email protected]>
drm/i915: no lvds quirk for Zotac ZDBOX SD ID12/ID13
Ian Abbott <[email protected]>
staging: comedi: amplc_pc236: fix invalid register access during detach
Yinghai Lu <[email protected]>
x86, mm: Undo incorrect revert in arch/x86/mm/init.c
Jacob Shin <[email protected]>
x86, mm: Find_early_table_space based on ranges that are actually being mapped
Andreas Herrmann <[email protected]>
cpufreq / powernow-k8: Remove usage of smp_processor_id() in preemptible code
Piotr Haber <[email protected]>
bcma: fix unregistration of cores
Stanislaw Gruszka <[email protected]>
mac80211: check if key has TKIP type before updating IV
Bo Shen <[email protected]>
ARM: at91/i2c: change id to let i2c-gpio work
Michael S. Tsirkin <[email protected]>
vhost: fix mergeable bufs on BE hosts
Sarah Sharp <[email protected]>
xhci: Fix potential NULL ptr deref in command cancellation.
Johan Hovold <[email protected]>
USB: mos7840: remove invalid disconnect handling
Johan Hovold <[email protected]>
USB: mos7840: remove NULL-urb submission
Johan Hovold <[email protected]>
USB: mos7840: fix port-device leak in error path
Johan Hovold <[email protected]>
USB: mos7840: fix urb leak at release
Johan Hovold <[email protected]>
USB: sierra: fix memory leak in probe error path
Johan Hovold <[email protected]>
USB: sierra: fix memory leak in attach error path
Lennart Sorensen <[email protected]>
USB: serial: Fix memory leak in sierra_release()
Johan Hovold <[email protected]>
USB: opticon: fix memory leak in error path
Johan Hovold <[email protected]>
USB: opticon: fix DMA from stack
Johan Hovold <[email protected]>
USB: whiteheat: fix memory leak in error path
Octavian Purdila <[email protected]>
usb hub: send clear_tt_buffer_complete events when canceling TT clear work
Michael Shigorin <[email protected]>
usb-storage: add unusual_devs entry for Casio EX-N1 digital camera
Anisse Astier <[email protected]>
ehci: Add yet-another Lucid nohandoff pci quirk
Anisse Astier <[email protected]>
ehci: fix Lucid nohandoff pci quirk to be more generic with BIOS versions
Geert Uytterhoeven <[email protected]>
sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat()
Trond Myklebust <[email protected]>
SUNRPC: Prevent races in xs_abort_connection()
Trond Myklebust <[email protected]>
Revert "SUNRPC: Ensure we close the socket on EPIPE errors too..."
Trond Myklebust <[email protected]>
SUNRPC: Clear the connect flag when socket state is TCP_CLOSE_WAIT
Trond Myklebust <[email protected]>
SUNRPC: Get rid of the xs_error_report socket callback
Will Deacon <[email protected]>
ARM: 7559/1: smp: switch away from the idmap before updating init_mm.mm_count
Thadeu Lima de Souza Cascardo <[email protected]>
genalloc: stop crashing the system when destroying a pool
Jan Luebbe <[email protected]>
drivers/rtc/rtc-imxdi.c: add missing spin lock initialization
Kees Cook <[email protected]>
fs/compat_ioctl.c: VIDEO_SET_SPU_PALETTE missing error check
Kees Cook <[email protected]>
gen_init_cpio: avoid stack overflow when expanding
-------------
Diffstat:
Makefile | 4 +- arch/arm/kernel/smp.c | 14 ++++-- arch/arm/mach-at91/at91rm9200_devices.c | 2 +- arch/arm/mach-at91/at91sam9260_devices.c | 2 +- arch/arm/mach-at91/at91sam9261_devices.c | 2 +- arch/arm/mach-at91/at91sam9263_devices.c | 2 +- arch/arm/mach-at91/at91sam9rl_devices.c | 2 +- arch/x86/mm/init.c | 69 ++++++++++++++++------------ drivers/bcma/main.c | 5 +- drivers/cpufreq/powernow-k8.c | 9 +--- drivers/gpu/drm/i915/intel_lvds.c | 8 ++++ drivers/rtc/rtc-imxdi.c | 2 + drivers/staging/comedi/drivers/amplc_pc236.c | 2 +- drivers/usb/core/hub.c | 7 ++- drivers/usb/host/pci-quirks.c | 9 +++- drivers/usb/host/xhci-ring.c | 11 +++++ drivers/usb/serial/mos7840.c | 30 ++---------- drivers/usb/serial/opticon.c | 11 ++++- drivers/usb/serial/sierra.c | 26 ++++++++--- drivers/usb/serial/whiteheat.c | 1 + drivers/usb/storage/unusual_devs.h | 6 +++ drivers/vhost/net.c | 3 +- fs/compat_ioctl.c | 2 + fs/sysfs/dir.c | 16 +++---- lib/genalloc.c | 2 +- net/mac80211/wpa.c | 3 +- net/sunrpc/xprtsock.c | 41 ++++------------- usr/gen_init_cpio.c | 43 +++++++++-------- 28 files changed, 181 insertions(+), 153 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/34 gen_init_cpio: avoid stack overflow when expanding
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 20f1de659b77364d55d4e7fad2ef657e7730323f upstream.
Fix possible overflow of the buffer used for expanding environment variables when building file list.
In the extremely unlikely case of an attacker having control over the environment variables visible to gen_init_cpio, control over the contents of the file gen_init_cpio parses, and gen_init_cpio was built without compiler hardening, the attacker can gain arbitrary execution control via a stack buffer overflow.
$ cat usr/crash.list
file foo ${BIG}${BIG}${BIG}${BIG}${BIG}${BIG} 0755 0 0
$ BIG=$(perl -e 'print "A" x 4096;') ./usr/gen_init_cpio usr/crash.list
*** buffer overflow detected ***: ./usr/gen_init_cpio terminatedThis also replaces the space-indenting with tabs.
Patch based on existing fix extracted from grsecurity.
--- usr/gen_init_cpio.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-)
usr/gen_init_cpio.c +22 -19
@@ -303,7 +303,7 @@ static int cpio_mkfile(const char *name,int retval;int rc =-1 ;int namesize; -int i; +unsigned int i; mode |=S_IFREG ;
@@ -381,25 +381,28 @@ error:static char *cpio_replace_env (char *new_location) { -char expanded[PATH_MAX +1 ]; -char env_var[PATH_MAX +1 ]; -char *start; -char *end; - -for (start =NULL ; (start =strstr (new_location,"${" )); ) { - end =strchr (start,'}' ); -if (start < end) { - *env_var = *expanded ='\0' ; -strncat (env_var, start +2 , end - start -2 ); -strncat (expanded, new_location, start - new_location); -strncat (expanded,getenv (env_var),PATH_MAX ); -strncat (expanded, end +1 ,PATH_MAX ); -strncpy (new_location, expanded,PATH_MAX ); - }else -break ; - } +char expanded[PATH_MAX +1 ]; +char env_var[PATH_MAX +1 ]; +char *start; +char *end; + +for (start =NULL ; (start =strstr (new_location,"${" )); ) { + end =strchr (start,'}' ); +if (start < end) { + *env_var = *expanded ='\0' ; +strncat (env_var, start +2 , end - start -2 ); +strncat (expanded, new_location, start - new_location); +strncat (expanded,getenv (env_var), +PATH_MAX -strlen (expanded)); +strncat (expanded, end +1 , +PATH_MAX -strlen (expanded)); +strncpy (new_location, expanded,PATH_MAX ); + new_location[PATH_MAX ] =0 ; + }else +break ; + } -return new_location; +return new_location; }
Greg Kroah-Hartman
maintainerPATCH 2/34 fs/compat_ioctl.c: VIDEO_SET_SPU_PALETTE missing error check
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 12176503366885edd542389eed3aaf94be163fdb upstream.
The compat ioctl for VIDEO_SET_SPU_PALETTE was missing an error check while converting ioctl arguments. This could lead to leaking kernel stack contents into userspace.
Patch extracted from existing fix in grsecurity.
--- fs/compat_ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/compat_ioctl.c +2 -0
@@ -208,6 +208,8 @@ static int do_video_set_spu_palette(unsi err =get_user (palp, &up->palette); err |=get_user (length, &up->length); +if (err) +return -EFAULT ; up_native =compat_alloc_user_space (sizeof (struct video_spu_palette )); err =put_user (compat_ptr (palp), &up_native->palette);
Greg Kroah-Hartman
maintainerPATCH 3/34 drivers/rtc/rtc-imxdi.c: add missing spin lock initialization
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Luebbe <[email protected]>
commit fee0de7791f967c2c5f0d43eb7b7261761b45e64 upstream.
--- drivers/rtc/rtc-imxdi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/rtc/rtc-imxdi.c +2 -0
@@ -391,6 +391,8 @@ static int dryice_rtc_probe(struct platfif (imxdi->ioaddr ==NULL )return -ENOMEM ; +spin_lock_init (&imxdi->irq_lock); + imxdi->irq =platform_get_irq (pdev,0 );if (imxdi->irq <0 )return imxdi->irq;
Greg Kroah-Hartman
maintainerPATCH 4/34 genalloc: stop crashing the system when destroying a pool
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
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
@@ -57,7 +57,7 @@ int gen_pool_add_virt(struct gen_pool *pstruct 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 ))
Greg Kroah-Hartman
maintainerPATCH 5/34 ARM: 7559/1: smp: switch away from the idmap before updating init_mm.mm_count
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 5f40b909728ad784eb43aa309d3c4e9bdf050781 upstream.
When booting a secondary CPU, the primary CPU hands two sets of page tables via the secondary_data struct:
(1) swapper_pg_dir: a normal, cacheable, shared (if SMP) mapping of the kernel image (i.e. the tables used by init_mm).
(2) idmap_pgd: an uncached mapping of the .idmap.text ELF section.
The idmap is generally used when enabling and disabling the MMU, which includes early CPU boot. In this case, the secondary CPU switches to swapper as soon as it enters C code:
struct mm_struct *mm = &init_mm; unsigned int cpu = smp_processor_id(); /* * All kernel threads share the same mm context; grab a * reference and switch to it. */ atomic_inc(&mm->mm_count); current->active_mm = mm; cpumask_set_cpu(cpu, mm_cpumask(mm)); cpu_switch_mm(mm->pgd, mm);
This causes a problem on ARMv7, where the identity mapping is treated as strongly-ordered leading to architecturally UNPREDICTABLE behaviour of exclusive accesses, such as those used by atomic_inc.
This patch re-orders the secondary_start_kernel function so that we switch to swapper before performing any exclusive accesses.
--- arch/arm/kernel/smp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
arch/arm/kernel/smp.c +10 -4
@@ -277,18 +277,24 @@ static void __cpuinit smp_store_cpu_info asmlinkage void __cpuinit secondary_start_kernel(void) {struct mm_struct *mm = &init_mm; -unsigned int cpu =smp_processor_id (); +unsigned int cpu; + +/* +* The identity mapping is uncached (strongly ordered), so +* switch away from it before attempting any exclusive accesses. +*/ +cpu_switch_mm (mm->pgd, mm); +enter_lazy_tlb (mm, current); +local_flush_tlb_all ();/* * All kernel threads share the same mm context; grab a * reference and switch to it. */ + cpu =smp_processor_id ();atomic_inc (&mm->mm_count); current->active_mm = mm;cpumask_set_cpu (cpu,mm_cpumask (mm)); -cpu_switch_mm (mm->pgd, mm); -enter_lazy_tlb (mm, current); -local_flush_tlb_all ();printk ("CPU%u: Booted secondary processor\n" , cpu);
Greg Kroah-Hartman
maintainerPATCH 6/34 SUNRPC: Get rid of the xs_error_report socket callback
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit f878b657ce8e7d3673afe48110ec208a29e38c4a upstream.
Chris Perl reports that we're seeing races between the wakeup call in xs_error_report and the connect attempts. Basically, Chris has shown that in certain circumstances, the call to xs_error_report causes the rpc_task that is responsible for reconnecting to wake up early, thus triggering a disconnect and retry.
Since the sk->sk_error_report() calls in the socket layer are always followed by a tcp_done() in the cases where we care about waking up the rpc_tasks, just let the state_change callbacks take responsibility for those wake ups.
--- net/sunrpc/xprtsock.c | 25 ------------------------- 1 file changed, 25 deletions(-)
net/sunrpc/xprtsock.c +0 -25
@@ -243,7 +243,6 @@ struct sock_xprt {void (*old_data_ready)(struct sock *,int );void (*old_state_change)(struct sock *);void (*old_write_space)(struct sock *); -void (*old_error_report)(struct sock *); };/*
@@ -768,7 +767,6 @@ static void xs_save_old_callbacks(struct transport->old_data_ready = sk->sk_data_ready; transport->old_state_change = sk->sk_state_change; transport->old_write_space = sk->sk_write_space; - transport->old_error_report = sk->sk_error_report; }static void xs_restore_old_callbacks (struct sock_xprt *transport,struct sock *sk)
@@ -776,7 +774,6 @@ static void xs_restore_old_callbacks(str sk->sk_data_ready = transport->old_data_ready; sk->sk_state_change = transport->old_state_change; sk->sk_write_space = transport->old_write_space; - sk->sk_error_report = transport->old_error_report; }static void xs_reset_transport (struct sock_xprt *transport)
@@ -1539,25 +1536,6 @@ static void xs_tcp_state_change(struct sread_unlock_bh (&sk->sk_callback_lock); } -/** -* xs_error_report - callback mainly for catching socket errors -* @sk: socket -*/ -static void xs_error_report (struct sock *sk) -{ -struct rpc_xprt *xprt; - -read_lock_bh (&sk->sk_callback_lock); -if (!(xprt =xprt_from_sock (sk))) - goto out; -dprintk ("RPC: %s client %p...\n" -"RPC: error %d\n" , - __func__, xprt, sk->sk_err); -xprt_wake_pending_tasks (xprt, -EAGAIN ); -out: -read_unlock_bh (&sk->sk_callback_lock); -} -static void xs_write_space (struct sock *sk) {struct socket *sock;
@@ -1857,7 +1835,6 @@ static int xs_local_finish_connecting(st sk->sk_user_data = xprt; sk->sk_data_ready = xs_local_data_ready; sk->sk_write_space = xs_udp_write_space; - sk->sk_error_report = xs_error_report; sk->sk_allocation =GFP_ATOMIC ;xprt_clear_connected (xprt);
@@ -1946,7 +1923,6 @@ static void xs_udp_finish_connecting(str sk->sk_user_data = xprt; sk->sk_data_ready = xs_udp_data_ready; sk->sk_write_space = xs_udp_write_space; - sk->sk_error_report = xs_error_report; sk->sk_no_check =UDP_CSUM_NORCV ; sk->sk_allocation =GFP_ATOMIC ;
@@ -2062,7 +2038,6 @@ static int xs_tcp_finish_connecting(stru sk->sk_data_ready = xs_tcp_data_ready; sk->sk_state_change = xs_tcp_state_change; sk->sk_write_space = xs_tcp_write_space; - sk->sk_error_report = xs_error_report; sk->sk_allocation =GFP_ATOMIC ;/* socket options */
Greg Kroah-Hartman
maintainerPATCH 7/34 SUNRPC: Clear the connect flag when socket state is TCP_CLOSE_WAIT
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit d0bea455dd48da1ecbd04fedf00eb89437455fdc upstream.
This is needed to ensure that we call xprt_connect() upon the next call to call_connect().
--- net/sunrpc/xprtsock.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/xprtsock.c +1 -0
@@ -1512,6 +1512,7 @@ static void xs_tcp_state_change(struct scase TCP_CLOSE_WAIT :/* The server initiated a shutdown of the socket */ xprt->connect_cookie++; +clear_bit (XPRT_CONNECTED , &xprt->state);xs_tcp_force_close (xprt);case TCP_CLOSING :/*
Greg Kroah-Hartman
maintainerPATCH 8/34 Revert "SUNRPC: Ensure we close the socket on EPIPE errors too..."
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit b9d2bb2ee537424a7f855e1f93eed44eb9ee0854 upstream.
This reverts commit 55420c24a0d4d1fce70ca713f84aa00b6b74a70e. Now that we clear the connected flag when entering TCP_CLOSE_WAIT, the deadlock described in this commit is no longer possible. Instead, the resulting call to xs_tcp_shutdown() can interfere with pending reconnection attempts.
--- net/sunrpc/xprtsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/xprtsock.c +1 -1
@@ -725,10 +725,10 @@ static int xs_tcp_send_request(struct rpdprintk ("RPC: sendmsg returned unrecognized error %d\n" , -status);case -ECONNRESET : -case -EPIPE :xs_tcp_shutdown (xprt);case -ECONNREFUSED :case -ENOTCONN : +case -EPIPE :clear_bit (SOCK_ASYNC_NOSPACE , &transport->sock->flags); }
Greg Kroah-Hartman
maintainerPATCH 9/34 SUNRPC: Prevent races in xs_abort_connection()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 4bc1e68ed6a8b59be8a79eb719be515a55c7bc68 upstream.
The call to xprt_disconnect_done() that is triggered by a successful connection reset will trigger another automatic wakeup of all tasks on the xprt->pending rpc_wait_queue. In particular it will cause an early wake up of the task that called xprt_connect().
All we really want to do here is clear all the socket-specific state flags, so we split that functionality out of xs_sock_mark_closed() into a helper that can be called by xs_abort_connection()
--- net/sunrpc/xprtsock.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/sunrpc/xprtsock.c +8 -5
@@ -1449,7 +1449,7 @@ static void xs_tcp_cancel_linger_timeoutxprt_clear_connecting (xprt); } -static void xs_sock_mark_closed (struct rpc_xprt *xprt) +static void xs_sock_reset_connection_flags (struct rpc_xprt *xprt) {smp_mb__before_clear_bit ();clear_bit (XPRT_CONNECTION_ABORT , &xprt->state);
@@ -1457,6 +1457,11 @@ static void xs_sock_mark_closed(struct rclear_bit (XPRT_CLOSE_WAIT , &xprt->state);clear_bit (XPRT_CLOSING , &xprt->state);smp_mb__after_clear_bit (); +} + +static void xs_sock_mark_closed (struct rpc_xprt *xprt) +{ +xs_sock_reset_connection_flags (xprt);/* Mark transport as closed and wake up all pending tasks */ xprt_disconnect_done (xprt); }
@@ -1991,10 +1996,8 @@ static void xs_abort_connection(struct s any.sa_family =AF_UNSPEC ; result =kernel_connect (transport->sock, &any,sizeof (any),0 );if (!result) -xs_sock_mark_closed (&transport->xprt); -else -dprintk ("RPC: AF_UNSPEC connect return code %d\n" , - result); +xs_sock_reset_connection_flags (&transport->xprt); +dprintk ("RPC: AF_UNSPEC connect return code %d\n" , result); }static void xs_tcp_reuse_connection (struct sock_xprt *transport)
Greg Kroah-Hartman
maintainerPATCH 10/34 sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 66081a72517a131430dcf986775f3268aafcb546 upstream.
The warning check for duplicate sysfs entries can cause a buffer overflow when printing the warning, as strcat() doesn't check buffer sizes. Use strlcat() instead.
Since strlcat() doesn't return a pointer to the passed buffer, unlike strcat(), I had to convert the nested concatenation in sysfs_add_one() to an admittedly more obscure comma operator construct, to avoid emitting code for the concatenation if CONFIG_BUG is disabled.
--- fs/sysfs/dir.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/sysfs/dir.c +8 -8
@@ -404,20 +404,18 @@ int __sysfs_add_one(struct sysfs_addrm_c/** * sysfs_pathname - return full path to sysfs dirent * @sd: sysfs_dirent whose path we want -* @path: caller allocated buffer +* @path: caller allocated buffer of size PATH_MAX * * Gives the name "/" to the sysfs_root entry; any path returned * is relative to wherever sysfs is mounted. -* -* XXX: does no error checking on @path size */ static char *sysfs_pathname (struct sysfs_dirent *sd,char *path) {if (sd->s_parent) {sysfs_pathname (sd->s_parent, path); -strcat (path,"/" ); +strlcat (path,"/" ,PATH_MAX ); } -strcat (path, sd->s_name); +strlcat (path, sd->s_name,PATH_MAX );return path; }
@@ -450,9 +448,11 @@ int sysfs_add_one(struct sysfs_addrm_cxtchar *path =kzalloc (PATH_MAX ,GFP_KERNEL );WARN (1 ,KERN_WARNING "sysfs: cannot create duplicate filename '%s'\n" , - (path ==NULL ) ? sd->s_name : -strcat (strcat (sysfs_pathname (acxt->parent_sd, path),"/" ), - sd->s_name)); + (path ==NULL ) ? sd->s_name + : (sysfs_pathname (acxt->parent_sd, path), +strlcat (path,"/" ,PATH_MAX ), +strlcat (path, sd->s_name,PATH_MAX ), + path));kfree (path); }
Greg Kroah-Hartman
maintainerPATCH 11/34 ehci: fix Lucid nohandoff pci quirk to be more generic with BIOS versions
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anisse Astier <[email protected]>
commit c323dc023b9501e5d09582ec7efd1d40a9001d99 upstream.
BIOS vendors keep changing the BIOS versions. Only match the beginning of the string to match all Lucid tablets with board name M11JB.
--- drivers/usb/host/pci-quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/pci-quirks.c +1 -1
@@ -543,7 +543,7 @@ static const struct dmi_system_id __devi/* Pegatron Lucid (Ordissimo AIRIS) */ .matches = {DMI_MATCH (DMI_BOARD_NAME ,"M11JB" ), - DMI_MATCH(DMI_BIOS_VERSION, "Lucid-GE-133"), + DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), }, }, { }
Greg Kroah-Hartman
maintainerPATCH 12/34 ehci: Add yet-another Lucid nohandoff pci quirk
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anisse Astier <[email protected]>
commit 8daf8b6086f9d575200cd0aa3797e26137255609 upstream.
Board name changed on another shipping Lucid tablet.
--- drivers/usb/host/pci-quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/host/pci-quirks.c +7 -0
@@ -546,6 +546,13 @@ static const struct dmi_system_id __devi DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), }, }, + { + /* Pegatron Lucid (Ordissimo) */ + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "Ordissimo"), + DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), + }, + }, { } };
Greg Kroah-Hartman
maintainerPATCH 13/34 usb-storage: add unusual_devs entry for Casio EX-N1 digital camera
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Shigorin <[email protected]>
commit d7870af7e2e3a91b462075ec1ca669b482215187 upstream.
This commit sets removable subclass for Casio EX-N1 digital camera.
The patch has been tested within an ALT Linux kernel:
http://git.altlinux.org/people/led/packages/?p=kernel-image-3.0.git;a=commitdiff;h=c0fd891836e89fe0c93a4d536a59216d90e4e3e7
See also https://bugzilla.kernel.org/show_bug.cgi?id=49221
--- drivers/usb/storage/unusual_devs.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/storage/unusual_devs.h +6 -0
@@ -1004,6 +1004,12 @@ UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9 USB_SC_8070, USB_PR_CB, NULL, US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ), +/* Submitted by Oleksandr Chumachenko <[email protected]> */ +UNUSUAL_DEV (0x07cf ,0x1167 ,0x0100 ,0x0100 , +"Casio" , +"EX-N1 DigitalCamera" , +USB_SC_8070 ,USB_PR_DEVICE ,NULL ,0 ), +/* Submitted by Hartmut Wahl <[email protected]>*/ UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, "Samsung",
Greg Kroah-Hartman
maintainerPATCH 14/34 usb hub: send clear_tt_buffer_complete events when canceling TT clear work
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Octavian Purdila <[email protected]>
commit 3b6054da68f9b0d5ed6a7ed0f42a79e61904352c upstream.
There is a race condition in the USB hub code with regard to handling TT clear requests that can get the HCD driver in a deadlock. Usually when an TT clear request is scheduled it will be executed immediately:
<7>[ 6.077583] usb 2-1.3: unlink qh1-0e01/f4d4db00 start 0 [1/2 us] <3>[ 6.078041] usb 2-1: clear tt buffer port 3, a3 ep2 t04048d82 <7>[ 6.078299] hub_tt_work:731 <7>[ 9.309089] usb 2-1.5: link qh1-0e01/f4d506c0 start 0 [1/2 us] <7>[ 9.324526] ehci_hcd 0000:00:1d.0: reused qh f4d4db00 schedule <7>[ 9.324539] usb 2-1.3: link qh1-0e01/f4d4db00 start 0 [1/2 us] <7>[ 9.341530] usb 1-1.1: link qh4-0e01/f397aec0 start 2 [1/2 us] <7>[ 10.116159] usb 2-1.3: unlink qh1-0e01/f4d4db00 start 0 [1/2 us] <3>[ 10.116459] usb 2-1: clear tt buffer port 3, a3 ep2 t04048d82 <7>[ 10.116537] hub_tt_work:731
However, if a suspend operation is triggered before hub_tt_work is scheduled, hub_quiesce will cancel the work without notifying the HCD driver:
<3>[ 35.033941] usb 2-1: clear tt buffer port 3, a3 ep2 t04048d80 <5>[ 35.034022] sd 0:0:0:0: [sda] Stopping disk <7>[ 35.034039] hub 2-1:1.0: hub_suspend <7>[ 35.034067] usb 2-1: unlink qh256-0001/f3b1ab00 start 1 [1/0 us] <7>[ 35.035085] hub 1-0:1.0: hub_suspend <7>[ 35.035102] usb usb1: bus suspend, wakeup 0 <7>[ 35.035106] ehci_hcd 0000:00:1a.0: suspend root hub <7>[ 35.035298] hub 2-0:1.0: hub_suspend <7>[ 35.035313] usb usb2: bus suspend, wakeup 0 <7>[ 35.035315] ehci_hcd 0000:00:1d.0: suspend root hub <6>[ 35.250017] PM: suspend of devices complete after 216.979 msecs <6>[ 35.250822] PM: late suspend of devices complete after 0.799 msecs <7>[ 35.252343] ehci_hcd 0000:00:1d.0: wakeup: 1 <7>[ 35.262923] ehci_hcd 0000:00:1d.0: --> PCI D3hot <7>[ 35.263302] ehci_hcd 0000:00:1a.0: wakeup: 1 <7>[ 35.273912] ehci_hcd 0000:00:1a.0: --> PCI D3hot <6>[ 35.274254] PM: noirq suspend of devices complete after 23.442 msecs <6>[ 35.274975] ACPI: Preparing to enter system sleep state S3 <6>[ 35.292666] PM: Saving platform NVS memory <7>[ 35.295030] Disabling non-boot CPUs ... <6>[ 35.297351] CPU 1 is now offline <6>[ 35.300345] CPU 2 is now offline <6>[ 35.303929] CPU 3 is now offline <7>[ 35.303931] lockdep: fixing up alternatives. <6>[ 35.304825] Extended CMOS year: 2000
When the device will resume the EHCI driver will get stuck in ehci_endpoint_disable waiting for the tt_clearing flag to reset:
<0>[ 47.610967] usb 2-1.3: **** DPM device timeout **** <7>[ 47.610972] f2f11c60 00000092 f2f11c0c c10624a5 00000003 f4c6e880 c1c8a4c0 c1c8a4c0 <7>[ 47.610983] 15c55698 0000000b f56b34c0 f2a45b70 f4c6e880 00000082 f2a4602c f2f11c30 <7>[ 47.610993] c10787f8 f4cac000 f2a45b70 00000000 f4cac010 f2f11c58 00000046 00000001 <7>[ 47.611004] Call Trace: <7>[ 47.611006] [<c10624a5>] ? sched_clock_cpu+0xf5/0x160 <7>[ 47.611019] [<c10787f8>] ? lock_release_holdtime.part.22+0x88/0xf0 <7>[ 47.611026] [<c103ed46>] ? lock_timer_base.isra.35+0x26/0x50 <7>[ 47.611034] [<c17592d3>] ? schedule_timeout+0x133/0x290 <7>[ 47.611044] [<c175b43e>] schedule+0x1e/0x50 <7>[ 47.611051] [<c17592d8>] schedule_timeout+0x138/0x290 <7>[ 47.611057] [<c10624a5>] ? sched_clock_cpu+0xf5/0x160 <7>[ 47.611063] [<c103e560>] ? usleep_range+0x40/0x40 <7>[ 47.611070] [<c1759445>] schedule_timeout_uninterruptible+0x15/0x20 <7>[ 47.611077] [<c14935f4>] ehci_endpoint_disable+0x64/0x160 <7>[ 47.611084] [<c147d1ee>] ? usb_hcd_flush_endpoint+0x10e/0x1d0 <7>[ 47.611092] [<c1165663>] ? sysfs_add_file+0x13/0x20 <7>[ 47.611100] [<c147d5a9>] usb_hcd_disable_endpoint+0x29/0x40 <7>[ 47.611107] [<c147fafc>] usb_disable_endpoint+0x5c/0x80 <7>[ 47.611111] [<c147fb57>] usb_disable_interface+0x37/0x50 <7>[ 47.611116] [<c1477650>] usb_reset_and_verify_device+0x4b0/0x640 <7>[ 47.611122] [<c1474665>] ? hub_port_status+0xb5/0x100 <7>[ 47.611129] [<c147a975>] usb_port_resume+0xd5/0x220 <7>[ 47.611136] [<c148877f>] generic_resume+0xf/0x30 <7>[ 47.611142] [<c14821a3>] usb_resume+0x133/0x180 <7>[ 47.611147] [<c1473b10>] ? usb_dev_thaw+0x10/0x10 <7>[ 47.611152] [<c1473b1d>] usb_dev_resume+0xd/0x10 <7>[ 47.611157] [<c13baa60>] dpm_run_callback+0x40/0xb0 <7>[ 47.611164] [<c13bdb03>] ? pm_runtime_enable+0x43/0x70 <7>[ 47.611171] [<c13bafc6>] device_resume+0x1a6/0x2c0 <7>[ 47.611177] [<c13ba940>] ? dpm_show_time+0xe0/0xe0 <7>[ 47.611183] [<c13bb0f9>] async_resume+0x19/0x40 <7>[ 47.611189] [<c10580c4>] async_run_entry_fn+0x64/0x160 <7>[ 47.611196] [<c104a244>] ? process_one_work+0x104/0x480 <7>[ 47.611203] [<c104a24c>] ? process_one_work+0x10c/0x480 <7>[ 47.611209] [<c104a2c0>] process_one_work+0x180/0x480 <7>[ 47.611215] [<c104a244>] ? process_one_work+0x104/0x480 <7>[ 47.611220] [<c1058060>] ? async_schedule+0x10/0x10 <7>[ 47.611226] [<c104c15c>] worker_thread+0x11c/0x2f0 <7>[ 47.611233] [<c104c040>] ? manage_workers.isra.27+0x1f0/0x1f0 <7>[ 47.611239] [<c10507f8>] kthread+0x78/0x80 <7>[ 47.611244] [<c1750000>] ? timer_cpu_notify+0xd6/0x20d <7>[ 47.611253] [<c1050780>] ? __init_kthread_worker+0x60/0x60 <7>[ 47.611258] [<c176357e>] kernel_thread_helper+0x6/0xd <7>[ 47.611283] ------------[ cut here ]------------
This patch changes hub_quiesce behavior to flush the TT clear work instead of canceling it, to make sure that no TT clear request remains uncompleted before suspend.
--- drivers/usb/core/hub.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/core/hub.c +5 -2
@@ -482,13 +482,16 @@ static void hub_tt_work(struct work_struint limit =100 ;spin_lock_irqsave (&hub->tt.lock, flags); -while (--limit && !list_empty (&hub->tt.clear_list)) { +while (!list_empty (&hub->tt.clear_list)) {struct list_head *next;struct usb_tt_clear *clear;struct usb_device *hdev = hub->hdev;const struct hc_driver *drv;int status; +if (!hub->quiescing && --limit <0 ) +break ; + next = hub->tt.clear_list.next; clear = list_entry (next, struct usb_tt_clear, clear_list);list_del (&clear->clear_list);
@@ -952,7 +955,7 @@ static void hub_quiesce(struct usb_hub *if (hub->has_indicators)cancel_delayed_work_sync (&hub->leds);if (hub->tt.hub) -cancel_work_sync (&hub->tt.clear_work); +flush_work_sync (&hub->tt.clear_work); }/* caller has locked the hub device */
Greg Kroah-Hartman
maintainerPATCH 15/34 USB: whiteheat: fix memory leak in error path
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit c129197c99550d356cf5f69b046994dd53cd1b9d upstream.
Make sure command buffer is deallocated in case of errors during attach.
--- drivers/usb/serial/whiteheat.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/whiteheat.c +1 -0
@@ -576,6 +576,7 @@ no_firmware:"%s: please contact [email protected]\n" , serial->type->description);kfree (result); +kfree (command);return -ENODEV ; no_command_private:
Greg Kroah-Hartman
maintainerPATCH 16/34 USB: opticon: fix DMA from stack
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit ea0dbebffe118724cd4df7d9b071ea8ee48d48f0 upstream.
Make sure to allocate the control-message buffer dynamically as some platforms cannot do DMA from stack.
Note that only the first byte of the old buffer was used.
--- drivers/usb/serial/opticon.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/serial/opticon.c +6 -1
@@ -160,7 +160,11 @@ static int send_control_msg(struct usb_s {struct usb_serial *serial = port->serial;int retval; -u8 buffer[2 ]; +u8 *buffer; + + buffer =kzalloc (1 ,GFP_KERNEL ); +if (!buffer) +return -ENOMEM ; buffer[0 ] = val;/* Send the message to the vendor control endpoint
@@ -169,6 +173,7 @@ static int send_control_msg(struct usb_s requesttype,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_INTERFACE , 0, 0, buffer, 1, 0); +kfree (buffer);return retval; }
Greg Kroah-Hartman
maintainerPATCH 17/34 USB: opticon: fix memory leak in error path
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit acbf0e5263de563e25f7c104868e4490b9e72b13 upstream.
Fix memory leak in write error path.
--- drivers/usb/serial/opticon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/serial/opticon.c +3 -1
@@ -297,7 +297,7 @@ static int opticon_write(struct tty_struif (!dr) {dev_err (&port->dev,"out of memory\n" ); count = -ENOMEM ; - goto error; + goto error_no_dr; } dr->bRequestType =USB_TYPE_VENDOR |USB_RECIP_INTERFACE |USB_DIR_OUT ;
@@ -327,6 +327,8 @@ static int opticon_write(struct tty_strureturn count; error: +kfree (dr); +error_no_dr:usb_free_urb (urb); error_no_urb:kfree (buffer);
Greg Kroah-Hartman
maintainerPATCH 18/34 USB: serial: Fix memory leak in sierra_release()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lennart Sorensen <[email protected]>
commit f7bc5051667b74c3861f79eed98c60d5c3b883f7 upstream.
I found a memory leak in sierra_release() (well sierra_probe() I guess) that looses 8 bytes each time the driver releases a device.
--- drivers/usb/serial/sierra.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/sierra.c +1 -0
@@ -993,6 +993,7 @@ static void sierra_release(struct usb_secontinue ;kfree (portdata); } +kfree (serial->private); }#ifdef CONFIG_PM
Greg Kroah-Hartman
maintainerPATCH 19/34 USB: sierra: fix memory leak in attach error path
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 7e41f9bcdd2e813ea2a3c40db291d87ea06b559f upstream.
Make sure port private data is deallocated on errors in attach.
--- drivers/usb/serial/sierra.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/serial/sierra.c +8 -1
@@ -937,7 +937,7 @@ static int sierra_startup(struct usb_serdev_dbg (&port->dev,"%s: kmalloc for " "sierra_port_private (%d) failed!\n" , __func__, i); -return -ENOMEM ; + goto err; }spin_lock_init (&portdata->lock);init_usb_anchor (&portdata->active);
@@ -974,6 +974,13 @@ static int sierra_startup(struct usb_ser }return 0 ; +err: +for (--i; i >=0 ; --i) { + portdata =usb_get_serial_port_data (serial->port[i]); +kfree (portdata); + } + +return -ENOMEM ; }static void sierra_release (struct usb_serial *serial)
Greg Kroah-Hartman
maintainerPATCH 20/34 USB: sierra: fix memory leak in probe error path
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 084817d79399ab5ccab2f90a148b0369912a8369 upstream.
Move interface data allocation to attach so that it is deallocated on errors in usb-serial probe.
--- drivers/usb/serial/sierra.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/usb/serial/sierra.c +10 -6
@@ -171,7 +171,6 @@ static int sierra_probe(struct usb_seria {int result =0 ;struct usb_device *udev; -struct sierra_intf_private *data;u8 ifnum; udev = serial->dev;
@@ -199,11 +198,6 @@ static int sierra_probe(struct usb_seriareturn -ENODEV ; } - data = serial->private =kzalloc (sizeof (struct sierra_intf_private ),GFP_KERNEL ); -if (!data) -return -ENOMEM ; -spin_lock_init (&data->susp_lock); -return result; }
@@ -915,6 +909,7 @@ static void sierra_dtr_rts(struct usb_sestatic int sierra_startup (struct usb_serial *serial) {struct usb_serial_port *port; +struct sierra_intf_private *intfdata;struct sierra_port_private *portdata;struct sierra_iface_info *himemoryp =NULL ;int i;
@@ -922,6 +917,14 @@ static int sierra_startup(struct usb_serdev_dbg (&serial->dev->dev,"%s\n" , __func__); + intfdata =kzalloc (sizeof (*intfdata),GFP_KERNEL ); +if (!intfdata) +return -ENOMEM ; + +spin_lock_init (&intfdata->susp_lock); + +usb_set_serial_data (serial, intfdata); +/* Set Device mode to D0 */ sierra_set_power_state (serial->dev,0x0000 );
@@ -979,6 +982,7 @@ err: portdata =usb_get_serial_port_data (serial->port[i]);kfree (portdata); } +kfree (intfdata);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 21/34 USB: mos7840: fix urb leak at release
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 65a4cdbb170e4ec1a7fa0e94936d47e24a17b0e8 upstream.
Make sure control urb is freed at release.
--- drivers/usb/serial/mos7840.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/mos7840.c +1 -0
@@ -2662,6 +2662,7 @@ static void mos7840_release(struct usb_s mos7840_port =mos7840_get_port_private (serial->port[i]);dbg ("mos7840_port %d = %p" , i, mos7840_port);if (mos7840_port) { +usb_free_urb (mos7840_port->control_urb);kfree (mos7840_port->ctrl_buf);kfree (mos7840_port->dr);kfree (mos7840_port);
Greg Kroah-Hartman
maintainerPATCH 22/34 USB: mos7840: fix port-device leak in error path
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 3eb55cc4ed88eee3b5230f66abcdbd2a91639eda upstream.
The driver set the usb-serial port pointers to NULL on errors in attach, effectively preventing usb-serial core from decrementing the port ref counters and releasing the port devices and associated data.
--- drivers/usb/serial/mos7840.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/serial/mos7840.c +0 -1
@@ -2595,7 +2595,6 @@ error:kfree (mos7840_port->ctrl_buf);usb_free_urb (mos7840_port->control_urb);kfree (mos7840_port); - serial->port[i] =NULL ; }return status; }
Greg Kroah-Hartman
maintainerPATCH 23/34 USB: mos7840: remove NULL-urb submission
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 28c3ae9a8cf45f439c9a0779ebd0256e2ae72813 upstream.
The private int_urb is never allocated so the submission from the control completion handler will always fail. Remove this odd piece of broken code.
--- drivers/usb/serial/mos7840.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/usb/serial/mos7840.c +1 -14
@@ -235,7 +235,6 @@ struct moschip_port {int port_num;/*Actual port number in the device(1,2,etc) */ struct urb *write_urb;/* write URB for this port */ struct urb *read_urb;/* read URB for this port */ -struct urb *int_urb;__u8 shadowLCR;/* last LCR value received */ __u8 shadowMCR;/* last MCR value received */ char open;
@@ -505,7 +504,6 @@ static void mos7840_control_callback(strunsigned char *data;struct moschip_port *mos7840_port;__u8 regval =0x0 ; -int result =0 ;int status = urb->status; mos7840_port = urb->context;
@@ -524,7 +522,7 @@ static void mos7840_control_callback(strdefault :dbg ("%s - nonzero urb status received: %d" , __func__, status); - goto exit; +return ; }dbg ("%s urb buffer size is %d" , __func__, urb->actual_length);
@@ -537,17 +535,6 @@ static void mos7840_control_callback(strmos7840_handle_new_msr (mos7840_port, regval); else if (mos7840_port->MsrLsr == 1) mos7840_handle_new_lsr(mos7840_port, regval); - -exit: -spin_lock (&mos7840_port->pool_lock); -if (!mos7840_port->zombie) - result =usb_submit_urb (mos7840_port->int_urb,GFP_ATOMIC ); -spin_unlock (&mos7840_port->pool_lock); -if (result) { -dev_err (&urb->dev->dev, -"%s - Error %d submitting interrupt urb\n" , - __func__, result); - } } static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg,
Greg Kroah-Hartman
maintainerPATCH 24/34 USB: mos7840: remove invalid disconnect handling
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit e681b66f2e19fadbe8a7e2a17900978cb6bc921f upstream.
Remove private zombie flag used to signal disconnect and to prevent control urb from being submitted from interrupt urb completion handler.
The control urb will not be re-submitted as both the control urb and the interrupt urb is killed on disconnect.
--- drivers/usb/serial/mos7840.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/usb/serial/mos7840.c +1 -12
@@ -239,7 +239,6 @@ struct moschip_port {__u8 shadowMCR;/* last MCR value received */ char open;char open_ports; -char zombie;wait_queue_head_t wait_chase;/* for handling sleeping while waiting for chase to finish */ wait_queue_head_t delta_msr_wait;/* for handling sleeping while waiting for msr change to happen */ int delta_msr_cond;
@@ -642,14 +641,7 @@ static void mos7840_interrupt_callback(s wreg =MODEM_STATUS_REGISTER ;break ; } -spin_lock (&mos7840_port->pool_lock); -if (!mos7840_port->zombie) { - rv =mos7840_get_reg (mos7840_port, wval, wreg, &Data); - }else { -spin_unlock (&mos7840_port->pool_lock); -return ; - } -spin_unlock (&mos7840_port->pool_lock); + rv =mos7840_get_reg (mos7840_port, wval, wreg, &Data); } } }
@@ -2612,9 +2604,6 @@ static void mos7840_disconnect(struct us mos7840_port =mos7840_get_port_private (serial->port[i]);dbg ("mos7840_port %d = %p" , i, mos7840_port);if (mos7840_port) { -spin_lock_irqsave (&mos7840_port->pool_lock, flags); - mos7840_port->zombie =1 ; -spin_unlock_irqrestore (&mos7840_port->pool_lock, flags);usb_kill_urb (mos7840_port->control_urb); } }
Greg Kroah-Hartman
maintainerPATCH 25/34 xhci: Fix potential NULL ptr deref in command cancellation.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 43a09f7fb01fa1e091416a2aa49b6c666458c1ee upstream.
The command cancellation code doesn't check whether find_trb_seg() couldn't find the segment that contains the TRB to be canceled. This could cause a NULL pointer deference later in the function when next_trb is called. It's unlikely to happen unless something is wrong with the command ring pointers, so add some debugging in case it happens.
This patch should be backported to stable kernels as old as 3.0, that contain the commit b63f4053cc8aa22a98e3f9a97845afe6c15d0a0d "xHCI:
handle command after aborting the command ring".
--- drivers/usb/host/xhci-ring.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/host/xhci-ring.c +11 -0
@@ -1215,6 +1215,17 @@ static void xhci_cmd_to_noop(struct xhci cur_seg =find_trb_seg (xhci->cmd_ring->first_seg, xhci->cmd_ring->dequeue, &cycle_state); +if (!cur_seg) { +xhci_warn (xhci,"Command ring mismatch, dequeue = %p %llx (dma)\n" , + xhci->cmd_ring->dequeue, + (unsigned long long ) +xhci_trb_virt_to_dma (xhci->cmd_ring->deq_seg, + xhci->cmd_ring->dequeue)); +xhci_debug_ring (xhci, xhci->cmd_ring); +xhci_dbg_ring_ptrs (xhci, xhci->cmd_ring); +return ; + } +/* find the command trb matched by cd from command ring */ for (cmd_trb = xhci->cmd_ring->dequeue; cmd_trb != xhci->cmd_ring->enqueue;
Greg Kroah-Hartman
maintainerPATCH 26/34 vhost: fix mergeable bufs on BE hosts
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Michael S. Tsirkin" <[email protected]>
commit 910a578f7e9400a78a3b13aba0b4d2df16a2cb05 upstream.
We copy head count to a 16 bit field, this works by chance on LE but on BE guest gets 0. Fix it up.
--- drivers/vhost/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vhost/net.c +2 -1
@@ -305,7 +305,8 @@ static void handle_rx(struct vhost_net * .hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE };size_t total_len =0 ; -int err, headcount, mergeable; +int err, mergeable; +s16 headcount;size_t vhost_hlen, sock_hlen;size_t vhost_len, sock_len;/* TODO: check that we are running from vhost_worker? */
Greg Kroah-Hartman
maintainerPATCH 27/34 ARM: at91/i2c: change id to let i2c-gpio work
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bo Shen <[email protected]>
commit 7840487cd6298f9f931103b558290d8d98d41c49 upstream.
The i2c core driver will turn the platform device ID to busnum When using platfrom device ID as -1, it means dynamically assigned the busnum. When writing code, we need to make sure the busnum, and call i2c_register_board_info(int busnum, ...) to register device if using -1, we do not know the value of busnum
In order to solve this issue, set the platform device ID as a fix number Here using 0 to match the busnum used in i2c_regsiter_board_info()
--- arch/arm/mach-at91/at91rm9200_devices.c | 2 +- arch/arm/mach-at91/at91sam9260_devices.c | 2 +- arch/arm/mach-at91/at91sam9261_devices.c | 2 +- arch/arm/mach-at91/at91sam9263_devices.c | 2 +- arch/arm/mach-at91/at91sam9rl_devices.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-at91/at91rm9200_devices.c +1 -1
@@ -454,7 +454,7 @@ static struct i2c_gpio_platform_data pdastatic struct platform_device at91rm9200_twi_device = { .name ="i2c-gpio" , - .id =-1 , + .id =0 , .dev.platform_data = &pdata, };
arch/arm/mach-at91/at91sam9260_devices.c +1 -1
@@ -459,7 +459,7 @@ static struct i2c_gpio_platform_data pdastatic struct platform_device at91sam9260_twi_device = { .name ="i2c-gpio" , - .id =-1 , + .id =0 , .dev.platform_data = &pdata, };
arch/arm/mach-at91/at91sam9261_devices.c +1 -1
@@ -276,7 +276,7 @@ static struct i2c_gpio_platform_data pdastatic struct platform_device at91sam9261_twi_device = { .name ="i2c-gpio" , - .id =-1 , + .id =0 , .dev.platform_data = &pdata, };
arch/arm/mach-at91/at91sam9263_devices.c +1 -1
@@ -534,7 +534,7 @@ static struct i2c_gpio_platform_data pdastatic struct platform_device at91sam9263_twi_device = { .name ="i2c-gpio" , - .id =-1 , + .id =0 , .dev.platform_data = &pdata, };
arch/arm/mach-at91/at91sam9rl_devices.c +1 -1
@@ -319,7 +319,7 @@ static struct i2c_gpio_platform_data pdastatic struct platform_device at91sam9rl_twi_device = { .name ="i2c-gpio" , - .id =-1 , + .id =0 , .dev.platform_data = &pdata, };
Greg Kroah-Hartman
maintainerPATCH 28/34 mac80211: check if key has TKIP type before updating IV
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 4045f72bcf3c293c7c5932ef001742d8bb5ded76 upstream.
This patch fix corruption which can manifest itself by following crash when switching on rfkill switch with rt2x00 driver:
https://bugzilla.redhat.com/attachment.cgi?id=615362
Pointer key->u.ccmp.tfm of group key get corrupted in:
ieee80211_rx_h_michael_mic_verify():
/* update IV in key information to be able to detect replays */
rx->key->u.tkip.rx[rx->security_idx].iv32 = rx->tkip_iv32;
rx->key->u.tkip.rx[rx->security_idx].iv16 = rx->tkip_iv16;because rt2x00 always set RX_FLAG_MMIC_STRIPPED, even if key is not TKIP.
We already check type of the key in different path in ieee80211_rx_h_michael_mic_verify() function, so adding additional check here is reasonable.
--- net/mac80211/wpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/wpa.c +2 -1
@@ -109,7 +109,8 @@ ieee80211_rx_h_michael_mic_verify(structif (status->flag &RX_FLAG_MMIC_ERROR ) goto mic_fail; -if (!(status->flag &RX_FLAG_IV_STRIPPED ) && rx->key) +if (!(status->flag &RX_FLAG_IV_STRIPPED ) && rx->key && + rx->key->conf.cipher ==WLAN_CIPHER_SUITE_TKIP ) goto update_iv;return RX_CONTINUE ;
Greg Kroah-Hartman
maintainerPATCH 29/34 bcma: fix unregistration of cores
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Piotr Haber <[email protected]>
commit 1fffa905adffbf0d3767fc978ef09afb830275eb upstream.
When cores are unregistered, entries
need to be removed from cores list in a safe manner.
--- drivers/bcma/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/bcma/main.c +3 -2
@@ -110,9 +110,10 @@ static int bcma_register_cores(struct bcstatic void bcma_unregister_cores (struct bcma_bus *bus) { -struct bcma_device *core; +struct bcma_device *core, *tmp; -list_for_each_entry (core, &bus->cores, list) { +list_for_each_entry_safe (core, tmp, &bus->cores, list) { +list_del (&core->list);if (core->dev_registered)device_unregister (&core->dev); }
Greg Kroah-Hartman
maintainerPATCH 30/34 cpufreq / powernow-k8: Remove usage of smp_processor_id() in preemptible code
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Herrmann <[email protected]>
commit e4df1cbcc1f329e53a1fff7450b2229e0addff20 upstream.
Commit 6889125b8b4e09c5e53e6ecab3433bed1ce198c9
(cpufreq/powernow-k8: workqueue user shouldn't migrate the kworker to another CPU) causes powernow-k8 to trigger a preempt warning, e.g.:
BUG: using smp_processor_id() in preemptible [00000000] code: cpufreq/3776 caller is powernowk8_target+0x20/0x49 Pid: 3776, comm: cpufreq Not tainted 3.6.0 #9 Call Trace: [<ffffffff8125b447>] debug_smp_processor_id+0xc7/0xe0 [<ffffffff814877e7>] powernowk8_target+0x20/0x49 [<ffffffff81482b02>] __cpufreq_driver_target+0x82/0x8a [<ffffffff81484fc6>] cpufreq_governor_performance+0x4e/0x54 [<ffffffff81482c50>] __cpufreq_governor+0x8c/0xc9 [<ffffffff81482e6f>] __cpufreq_set_policy+0x1a9/0x21e [<ffffffff814839af>] store_scaling_governor+0x16f/0x19b [<ffffffff81484f16>] ? cpufreq_update_policy+0x124/0x124 [<ffffffff8162b4a5>] ? _raw_spin_unlock_irqrestore+0x2c/0x49 [<ffffffff81483640>] store+0x60/0x88 [<ffffffff811708c0>] sysfs_write_file+0xf4/0x130 [<ffffffff8111243b>] vfs_write+0xb5/0x151 [<ffffffff811126e0>] sys_write+0x4a/0x71 [<ffffffff816319a9>] system_call_fastpath+0x16/0x1b
Fix this by by always using work_on_cpu().
--- drivers/cpufreq/powernow-k8.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/cpufreq/powernow-k8.c +1 -8
@@ -1216,14 +1216,7 @@ static int powernowk8_target(struct cpufstruct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq, .relation = relation }; -/* -* Must run on @pol->cpu. cpufreq core is responsible for ensuring -* that we're bound to the current CPU and pol->cpu stays online. -*/ -if (smp_processor_id () == pol->cpu) -return powernowk8_target_fn (&pta); -else -return work_on_cpu (pol->cpu, powernowk8_target_fn, &pta); +return work_on_cpu (pol->cpu, powernowk8_target_fn, &pta); }/* Driver entry point to verify the policy and range of frequencies */
Greg Kroah-Hartman
maintainerPATCH 31/34 x86, mm: Find_early_table_space based on ranges that are actually being mapped
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Shin <[email protected]>
commit 844ab6f993b1d32eb40512503d35ff6ad0c57030 upstream.
Current logic finds enough space for direct mapping page tables from 0 to end. Instead, we only need to find enough space to cover mr[0].start to mr[nr_range].end -- the range that is actually being mapped by init_memory_mapping()
This is needed after 1bbbbe779aabe1f0768c2bf8f8c0a5583679b54a, to address the panic reported here:
https://lkml.org/lkml/2012/10/20/160
https://lkml.org/lkml/2012/10/21/157
--- arch/x86/mm/init.c | 73 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 30 deletions(-)
arch/x86/mm/init.c +43 -30
@@ -28,36 +28,54 @@ int direct_gbpages#endif ; -static void __init find_early_table_space (unsigned long end,int use_pse, -int use_gbpages) +struct map_range { +unsigned long start; +unsigned long end; +unsigned page_size_mask; +}; + +/* +* First calculate space needed for kernel direct mapping page tables to cover +* mr[0].start to mr[nr_range - 1].end, while accounting for possible 2M and 1GB +* pages. Then find enough contiguous space for those page tables. +*/ +static void __init find_early_table_space (struct map_range *mr,int nr_range) { -unsigned long puds, pmds, ptes, tables, start =0 , good_end = end; +int i; +unsigned long puds =0 , pmds =0 , ptes =0 , tables; +unsigned long start =0 , good_end;phys_addr_t base; - puds = (end +PUD_SIZE -1 ) >>PUD_SHIFT ; - tables =roundup (puds *sizeof (pud_t),PAGE_SIZE ); +for (i =0 ; i < nr_range; i++) { +unsigned long range, extra; -if (use_gbpages) { -unsigned long extra; + range = mr[i].end - mr[i].start; + puds += (range +PUD_SIZE -1 ) >>PUD_SHIFT ; - extra = end - ((end>>PUD_SHIFT ) <<PUD_SHIFT ); - pmds = (extra +PMD_SIZE -1 ) >>PMD_SHIFT ; - }else - pmds = (end +PMD_SIZE -1 ) >>PMD_SHIFT ; - - tables +=roundup (pmds *sizeof (pmd_t),PAGE_SIZE ); +if (mr[i].page_size_mask & (1 <<PG_LEVEL_1G )) { + extra = range - ((range >>PUD_SHIFT ) <<PUD_SHIFT ); + pmds += (extra +PMD_SIZE -1 ) >>PMD_SHIFT ; + }else { + pmds += (range +PMD_SIZE -1 ) >>PMD_SHIFT ; + } -if (use_pse) { -unsigned long extra; - - extra = end - ((end>>PMD_SHIFT ) <<PMD_SHIFT ); +if (mr[i].page_size_mask & (1 <<PG_LEVEL_2M )) { + extra = range - ((range >>PMD_SHIFT ) <<PMD_SHIFT );#ifdef CONFIG_X86_32 - extra +=PMD_SIZE ; + extra +=PMD_SIZE ;#endif - ptes = (extra +PAGE_SIZE -1 ) >>PAGE_SHIFT ; - }else - ptes = (end +PAGE_SIZE -1 ) >>PAGE_SHIFT ; +/* The first 2/4M doesn't use large pages. */ +if (mr[i].start <PMD_SIZE ) + extra += range; + + ptes += (extra +PAGE_SIZE -1 ) >>PAGE_SHIFT ; + }else { + ptes += (range +PAGE_SIZE -1 ) >>PAGE_SHIFT ; + } + } + tables =roundup (puds *sizeof (pud_t),PAGE_SIZE ); + tables +=roundup (pmds *sizeof (pmd_t),PAGE_SIZE ); tables +=roundup (ptes *sizeof (pte_t),PAGE_SIZE );#ifdef CONFIG_X86_32
@@ -74,8 +92,9 @@ static void __init find_early_table_spac pgt_buf_end = pgt_buf_start; pgt_buf_top = pgt_buf_start + (tables >>PAGE_SHIFT ); -printk (KERN_DEBUG "kernel direct mapping tables up to %lx @ %lx-%lx\n" , - end, pgt_buf_start <<PAGE_SHIFT , pgt_buf_top <<PAGE_SHIFT ); +printk (KERN_DEBUG "kernel direct mapping tables up to %#lx @ [mem %#010lx-%#010lx]\n" , + mr[nr_range -1 ].end -1 , pgt_buf_start <<PAGE_SHIFT , + (pgt_buf_top <<PAGE_SHIFT ) -1 ); }void __init native_pagetable_reserve (u64 start,u64 end)
@@ -83,12 +102,6 @@ void __init native_pagetable_reserve(u64memblock_x86_reserve_range (start, end,"PGTABLE" ); } -struct map_range { -unsigned long start; -unsigned long end; -unsigned page_size_mask; -}; -#ifdef CONFIG_X86_32 #define NR_RANGE_MR 3#else /* CONFIG_X86_64 */
@@ -260,7 +273,7 @@ unsigned long __init_refok init_memory_m* nodes are discovered. */ if (!after_bootmem) -find_early_table_space (end, use_pse, use_gbpages); +find_early_table_space (mr, nr_range);for (i =0 ; i < nr_range; i++) ret = kernel_physical_mapping_init(mr[i].start, mr[i].end,
Greg Kroah-Hartman
maintainerPATCH 32/34 x86, mm: Undo incorrect revert in arch/x86/mm/init.c
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yinghai Lu <[email protected]>
commit f82f64dd9f485e13f29f369772d4a0e868e5633a upstream.
Commit
844ab6f9 x86, mm: Find_early_table_space based on ranges that are actually being mapped
added back some lines back wrongly that has been removed in commit
7b16bbf97 Revert "x86/mm: Fix the size calculation of mapping tables"
remove them again.
--- arch/x86/mm/init.c | 4 ---- 1 file changed, 4 deletions(-)
arch/x86/mm/init.c +0 -4
@@ -64,10 +64,6 @@ static void __init find_early_table_spac#ifdef CONFIG_X86_32 extra +=PMD_SIZE ;#endif -/* The first 2/4M doesn't use large pages. */ -if (mr[i].start <PMD_SIZE ) - extra += range; - ptes += (extra +PAGE_SIZE -1 ) >>PAGE_SHIFT ; }else { ptes += (range +PAGE_SIZE -1 ) >>PAGE_SHIFT ;
Greg Kroah-Hartman
maintainerPATCH 33/34 staging: comedi: amplc_pc236: fix invalid register access during detach
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit aaeb61a97b7159ebe30b18a422d04eeabfa8790b upstream.
pc236_detach() is called by the comedi core if it attempted to attach a device and failed. pc236_detach() calls pc236_intr_disable() if the comedi device private data pointer (devpriv) is non-null. This test is insufficient as pc236_intr_disable() accesses hardware registers and the attach routine may have failed before it has saved their I/O base addresses.
Fix it by checking dev->iobase is non-zero before calling pc236_intr_disable() as that means the I/O base addresses have been saved and the hardware registers can be accessed. It also implies the comedi device private data pointer is valid, so there is no need to check it.
--- drivers/staging/comedi/drivers/amplc_pc236.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/amplc_pc236.c +1 -1
@@ -470,7 +470,7 @@ static int pc236_detach(struct comedi_de {printk (KERN_DEBUG "comedi%d: %s: detach\n" , dev->minor,PC236_DRIVER_NAME ); -if (devpriv) +if (dev->iobase)pc236_intr_disable (dev);if (dev->irq)
Greg Kroah-Hartman
maintainerPATCH 34/34 drm/i915: no lvds quirk for Zotac ZDBOX SD ID12/ID13
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sjoerd Simons <[email protected]>
commit 9756fe38d10b2bf90c81dc4d2f17d5632e135364 upstream.
This box claims to have an LVDS interface but doesn't actually have one.
--- drivers/gpu/drm/i915/intel_lvds.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_lvds.c +8 -0
@@ -751,6 +751,14 @@ static const struct dmi_system_id intel_ DMI_MATCH(DMI_BOARD_NAME, "MS-7469"), }, }, + { + .callback = intel_no_lvds_dmi_callback, + .ident = "ZOTAC ZBOXSD-ID12/ID13", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ZOTAC"), + DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"), + }, + }, { }/* terminating entry */ };