1
0
Fork 0

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>
hifive-unleashed-5.1
Bjørn Mork 2012-01-16 12:41:47 +01:00 committed by Greg Kroah-Hartman
parent 1097ccebe6
commit c428b70c1e
1 changed files with 2 additions and 0 deletions

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