]> git.baikalelectronics.ru Git - kernel.git/commit
usb: cdc-wdm: avoid hanging on zero length reads
authorBjørn Mork <bjorn@mork.no>
Fri, 20 Dec 2013 13:07:24 +0000 (14:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Dec 2013 20:06:46 +0000 (12:06 -0800)
commit0b55a15bc27a5d15d8aa88ea9775beed36b30191
treee4c61bc41c7b2c580fedc55056cfa74939500958
parentf6f18cd6e2e6fa98903961b99d5d713bf551f429
usb: cdc-wdm: avoid hanging on zero length reads

commit 2952f4cac192 ("USB: cdc-wdm: support back-to-back
USB_CDC_NOTIFY_RESPONSE_AVAILABLE notifications") implemented
queued response handling. This added a new requirement: The read
urb must be resubmitted every time we clear the WDM_READ flag if
the response counter indicates that the device is waiting for a
read.

Fix by factoring out the code handling the WMD_READ clearing and
possible urb submission, calling it everywhere we clear the flag.

Without this fix, the driver ends up in a state where the read urb
is inactive, but the response counter is positive after a zero
length read.  This prevents the read urb from ever being submitted
again and the driver appears to be hanging.

Fixes: 2952f4cac192 ("USB: cdc-wdm: support back-to-back USB_CDC_NOTIFY_RESPONSE_AVAILABLE notifications")
Cc: Greg Suarez <gsuarez@smithmicro.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Cc: stable <stable@vger.kernel.org> # 3.13
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-wdm.c