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: [email protected]
Signed-off-by: Bjørn Mork <[email protected]>
Acked-by: Oliver Neukum <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Bjørn Mork 2012-01-16 12:41:47 +01:00 • committed by Greg Kroah-Hartman
commit c428b70c1e

View file

@ -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);