diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2016-01-26 10:50:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-03 17:01:47 -0500 |
commit | 5c82171167adb8e4ac77b91a42cd49fb211a81a0 (patch) | |
tree | 916bb8042a5427c17a01c63f13a4a08c1a5c5782 | |
parent | 2ad294d5f9d13d108c1e2f1a4be8542859ead134 (diff) |
xhci: Fix list corruption in urb dequeue at host removal
xhci driver frees data for all devices, both usb2 and and usb3 the
first time usb_remove_hcd() is called, including td_list and and xhci_ring
structures.
When usb_remove_hcd() is called a second time for the second xhci bus it
will try to dequeue all pending urbs, and touches td_list which is already
freed for that endpoint.
Cc: <stable@vger.kernel.org>
Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Tested-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/xhci.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 26a44c0e969e..0c8087d3c313 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -1554,7 +1554,9 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1554 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 1554 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
1555 | "HW died, freeing TD."); | 1555 | "HW died, freeing TD."); |
1556 | urb_priv = urb->hcpriv; | 1556 | urb_priv = urb->hcpriv; |
1557 | for (i = urb_priv->td_cnt; i < urb_priv->length; i++) { | 1557 | for (i = urb_priv->td_cnt; |
1558 | i < urb_priv->length && xhci->devs[urb->dev->slot_id]; | ||
1559 | i++) { | ||
1558 | td = urb_priv->td[i]; | 1560 | td = urb_priv->td[i]; |
1559 | if (!list_empty(&td->td_list)) | 1561 | if (!list_empty(&td->td_list)) |
1560 | list_del_init(&td->td_list); | 1562 | list_del_init(&td->td_list); |