]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
cdc-acm: fix race between reset and control messaging
authorOliver Neukum <oneukum@suse.com>
Thu, 4 Oct 2018 13:49:06 +0000 (15:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Oct 2018 14:13:42 +0000 (16:13 +0200)
If a device splits up a control message and a reset() happens
between the parts, the message is lost and already recieved parts
must be dropped.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Fixes: 1aba579f3cf51 ("cdc-acm: handle read pipe errors")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-acm.c

index bc03b0a690b4d166b9984d2677642797a421551f..1833912f7f5fc7b03c2d6b760d09ae075758f3f3 100644 (file)
@@ -1642,6 +1642,7 @@ static int acm_pre_reset(struct usb_interface *intf)
        struct acm *acm = usb_get_intfdata(intf);
 
        clear_bit(EVENT_RX_STALL, &acm->flags);
+       acm->nb_index = 0; /* pending control transfers are lost */
 
        return 0;
 }