]> git.ipfire.org Git - thirdparty/kernel/stable.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>
Sat, 10 Nov 2018 15:49:46 +0000 (07:49 -0800)
commit 9397940ed812b942c520e0c25ed4b2c64d57e8b9 upstream.

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 539a8a8f028ed3657b0c9286b9c1ed714ab48525..b61d101894efa1570d6e5e608b9f0acbf946a142 100644 (file)
@@ -1641,6 +1641,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;
 }