summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Wolter <wolly84@web.de>2013-08-14 10:33:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-05 07:00:39 -0700
commit314bb48ec028ae62cec4a1371cdd84b672d5a759 (patch)
tree8056b501081a0b9c98d9ed7d2b96f78d12fd2604
parenta86384dbc0bf86e10301eb8eaafb9d49c90e3183 (diff)
downloadlinux-stable-314bb48ec028ae62cec4a1371cdd84b672d5a759.tar.gz
linux-stable-314bb48ec028ae62cec4a1371cdd84b672d5a759.tar.bz2
linux-stable-314bb48ec028ae62cec4a1371cdd84b672d5a759.zip
xhci: Fix race between ep halt and URB cancellation
commit 526867c3ca0caa2e3e846cb993b0f961c33c2abb upstream. The halted state of a endpoint cannot be cleared over CLEAR_HALT from a user process, because the stopped_td variable was overwritten in the handle_stopped_endpoint() function. So the xhci_endpoint_reset() function will refuse the reset and communication with device can not run over this endpoint. https://bugzilla.kernel.org/show_bug.cgi?id=60699 Signed-off-by: Florian Wolter <wolly84@web.de> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: Jonghwan Choi <jhbird.choi@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci-ring.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 244a5e241bed..40e39df46f2e 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -882,8 +882,12 @@ remove_finished_td:
/* Otherwise ring the doorbell(s) to restart queued transfers */
ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
}
- ep->stopped_td = NULL;
- ep->stopped_trb = NULL;
+
+ /* Clear stopped_td and stopped_trb if endpoint is not halted */
+ if (!(ep->ep_state & EP_HALTED)) {
+ ep->stopped_td = NULL;
+ ep->stopped_trb = NULL;
+ }
/*
* Drop the lock and complete the URBs in the cancelled TD list.