Hello. Weng, Wending wrote:
[PATCH] When the usb-serial cable is unpluged, the usb host controller driver returns all scheduled URBs to usb-serial driver(cdc-acm.c), and the usb-serial driver(cdc-acm.c) doesn't detect this exception, continues to schedule the URBs, it causes a dead loop. This change fixes this problem.
Signed-off-by: Wending Weng <wweng@xxxxxxxxxxxxxx>
[...]
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 38bfdb0..3cc3e18 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -372,8 +372,15 @@ static void acm_read_bulk(struct urb *urb) list_add_tail(&rcv->list, &acm->spare_read_urbs); list_add(&buf->list, &acm->spare_read_bufs); spin_unlock(&acm->read_lock); - /* nevertheless the tasklet must be kicked unconditionally - so the queue cannot dry up */ + + /* Normally, the tasklet must be kicked unconditionally + so the queue cannot dry up, however, if the cable is disconnected, + or whatever fatal error, it must not reschedule any URB */ + + // Stop rescheduling any URB in case the connection is shutdown + if ((urb->status == -ESHUTDOWN) || (urb->status == -EPROTO)) + return; +
Documentation/CodingStyle, chapter 8: The preferred style for long (multi-line) comments is: /* * This is the preferred style for multi-line * comments in the Linux kernel source code. * Please use it consistently. * * Description: A column of asterisks on the left side, * with beginning and ending almost-blank lines. */ WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html