kernel 2.6.31.-rc1 drivers/usb/class/cdc-acm.c patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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>
---
 drivers/usb/class/cdc-acm.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

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;
+
 	}
 	if (likely(!acm->susp_count))
 		tasklet_schedule(&acm->urb_task);
-- 
1.5.2.1


--
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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux