summaryrefslogtreecommitdiff
path: root/drivers/usb/class/cdc-wdm.c
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2012-01-16 15:41:47 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-25 00:17:29 +0400
commitc428b70c1e115c5649707a602742e34130d19428 (patch)
treedb052452481dc195d66c1e2761112b62f24a2b6a /drivers/usb/class/cdc-wdm.c
parent1097ccebe630170080c41df0edcf88e0626e9c75 (diff)
downloadlinux-c428b70c1e115c5649707a602742e34130d19428.tar.xz
USB: cdc-wdm: updating desc->length must be protected by spin_lock
wdm_in_callback() will also touch this field, so we cannot change it without locking Cc: stable@vger.kernel.org Signed-off-by: Bjørn Mork <bjorn@mork.no> Acked-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/class/cdc-wdm.c')
-rw-r--r--drivers/usb/class/cdc-wdm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 1c50baff7725..1f6b5c8394b4 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -467,7 +467,9 @@ retry:
for (i = 0; i < desc->length - cntr; i++)
desc->ubuf[i] = desc->ubuf[i + cntr];
+ spin_lock_irq(&desc->iuspin);
desc->length -= cntr;
+ spin_unlock_irq(&desc->iuspin);
/* in case we had outstanding data */
if (!desc->length)
clear_bit(WDM_READ, &desc->flags);