summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2013-09-05 11:01:20 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-05 07:00:39 -0700
commita86384dbc0bf86e10301eb8eaafb9d49c90e3183 (patch)
treee0759393d2810cda314c46cec50120cba25d9f34
parent79e1fc8a531ebe5da1078d765fadf6662edad612 (diff)
downloadlinux-stable-a86384dbc0bf86e10301eb8eaafb9d49c90e3183.tar.gz
linux-stable-a86384dbc0bf86e10301eb8eaafb9d49c90e3183.tar.bz2
linux-stable-a86384dbc0bf86e10301eb8eaafb9d49c90e3183.zip
xhci: Fix oops happening after address device timeout
commit 284d20552461466b04d6bfeafeb1c47a8891b591 upstream. When a command times out, the command ring is first aborted, and then stopped. If the command ring is empty when it is stopped the stop event will point to next command which is not yet set. xHCI tries to handle this next event often causing an oops. Don't handle command completion events on stopped cmd ring if ring is empty. This patch should be backported to kernels as old as 3.7, that contain the commit b92cc66c047ff7cf587b318fe377061a353c120f "xHCI: add aborting command ring function" Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Reported-by: Giovanni <giovanni.nervi@yahoo.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci-ring.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index f40567efaf36..244a5e241bed 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1377,6 +1377,12 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
inc_deq(xhci, xhci->cmd_ring, false);
return;
}
+ /* There is no command to handle if we get a stop event when the
+ * command ring is empty, event->cmd_trb points to the next
+ * unset command
+ */
+ if (xhci->cmd_ring->dequeue == xhci->cmd_ring->enqueue)
+ return;
}
switch (le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3])