Commit 9ff7cc901d7343226dc070d0bc23d832a75c4cf9

Authored by Johan Hovold
Committed by Greg Kroah-Hartman
1 parent 5bc7f43490

USB: cdc-acm: fix I/O after failed open

commit e4c36076c2a6195ec62c35b03c3fde84d0087dc8 upstream.

Make sure to kill any already submitted read urbs on read-urb submission
failures in open in order to prevent doing I/O for a closed port.

Fixes: 088c64f81284 ("USB: cdc-acm: re-write read processing")
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

drivers/usb/class/cdc-acm.c
... ... @@ -506,6 +506,7 @@
506 506 {
507 507 struct acm *acm = container_of(port, struct acm, port);
508 508 int retval = -ENODEV;
  509 + int i;
509 510  
510 511 dev_dbg(&acm->control->dev, "%s\n", __func__);
511 512  
... ... @@ -556,6 +557,8 @@
556 557 return 0;
557 558  
558 559 error_submit_read_urbs:
  560 + for (i = 0; i < acm->rx_buflimit; i++)
  561 + usb_kill_urb(acm->read_urbs[i]);
559 562 acm->ctrlout = 0;
560 563 acm_set_control(acm, acm->ctrlout);
561 564 error_set_control: