1
0
Fork 0
alistair23-linux/drivers/usb/class
Bjørn Mork f563926fed usb: cdc-wdm: resp_count can be 0 even if WDM_READ is set
Do not decrement resp_count if it's already 0.

We set resp_count to 0 when the device is closed.  The next open and
read will try to clear the WDM_READ flag if there was leftover data
in the read buffer. This fix is necessary to prevent resubmitting
the read URB in a tight loop because resp_count becomes negative.

The bug can easily be triggered from userspace by not reading all
data in the read buffer, and then closing and reopening the chardev.

Fixes: 8dd5cd5395 ("usb: cdc-wdm: avoid hanging on zero length reads")
Cc: <stable@vger.kernel.org> # 3.13
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-12 20:13:28 -08:00
..
Kconfig USB: regroup all depends on USB within an if USB block 2013-04-09 16:49:07 -07:00
Makefile USB: add USB test and measurement class driver 2008-10-17 14:40:51 -07:00
cdc-acm.c Merge branch 3.13-rc4 into usb-next 2013-12-16 08:46:03 -08:00
cdc-acm.h cdc-acm: add TIOCMIWAIT 2013-12-03 10:23:46 -08:00
cdc-wdm.c usb: cdc-wdm: resp_count can be 0 even if WDM_READ is set 2014-01-12 20:13:28 -08:00
usblp.c usb: delete non-required instances of include <linux/init.h> 2014-01-08 15:01:39 -08:00
usbtmc.c usb: delete non-required instances of include <linux/init.h> 2014-01-08 15:01:39 -08:00