]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
xhci: Fix race between ep halt and URB cancellation
authorFlorian Wolter <wolly84@web.de>
Wed, 14 Aug 2013 08:33:16 +0000 (10:33 +0200)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 23 Sep 2013 22:43:31 +0000 (15:43 -0700)
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>
drivers/usb/host/xhci-ring.c

index dd02402700d5f71460741a2c43080a4f4eb1e8a3..6bfbd80ec2b9edfa0a079767381d7d733d8c7035 100644 (file)
@@ -869,8 +869,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.