summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBin Liu <b-liu@ti.com>2017-07-25 09:31:33 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-16 13:40:30 -0700
commit921a1ed2a11ad05ffd95171a6b7509634baab760 (patch)
tree8307c3039517985e3e0bef81c52df3ebb61577c2
parentbc2f02f745491d487a799d94fabf2a2e4cef4cb6 (diff)
usb: core: unlink urbs from the tail of the endpoint's urb_list
commit 2eac13624364db5b5e1666ae0bb3a4d36bc56b6e upstream. While unlink an urb, if the urb has been programmed in the controller, the controller driver might do some hw related actions to tear down the urb. Currently usb_hcd_flush_endpoint() passes each urb from the head of the endpoint's urb_list to the controller driver, which could make the controller driver think each urb has been programmed and take the unnecessary actions for each urb. This patch changes the behavior in usb_hcd_flush_endpoint() to pass the urbs from the tail of the list, to avoid any unnecessary actions in an controller driver. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/core/hcd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 12c123762b76..5c0952995280 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1851,7 +1851,7 @@ void usb_hcd_flush_endpoint(struct usb_device *udev,
/* No more submits can occur */
spin_lock_irq(&hcd_urb_list_lock);
rescan:
- list_for_each_entry (urb, &ep->urb_list, urb_list) {
+ list_for_each_entry_reverse(urb, &ep->urb_list, urb_list) {
int is_in;
if (urb->unlinked)