]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
USB: xhci: Fix issue with set interface after stall.
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Thu, 6 May 2010 20:40:08 +0000 (13:40 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:15:43 +0000 (11:15 -0700)
commit 1624ae1c19e227096ba85bfc389d9b99cb6f7dde upstream.

When the USB core installs a new interface, it unconditionally clears the
halts on all the endpoints on the new interface.  Usually the xHCI host
needs to know when an endpoint is reset, so it can change its internal
endpoint state.  In this case, it doesn't care, because the endpoints were
never halted in the first place.

To avoid issuing a redundant Reset Endpoint command, the xHCI driver looks
at xhci_virt_ep->stopped_td to determine if the endpoint was actually
halted.  However, the functions that handle the stall never set that
variable to NULL after it dealt with the stall.  So if an endpoint stalled
and a Reset Endpoint command completed, and then the class driver tried to
install a new alternate setting, the xHCI driver would access the old
xhci_virt_ep->stopped_td pointer.  A similar problem occurs if the
endpoint has been stopped to cancel a transfer.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/xhci-hcd.c
drivers/usb/host/xhci-ring.c

index fa920c7ed029304117d6a530b3cf953db531f2a6..d9ea7598b5e9ab6bbd73e0338d12a9365b07d7ca 100644 (file)
@@ -1452,6 +1452,8 @@ void xhci_endpoint_reset(struct usb_hcd *hcd,
                kfree(virt_ep->stopped_td);
                xhci_ring_cmd_db(xhci);
        }
+       virt_ep->stopped_td = NULL;
+       virt_ep->stopped_trb = NULL;
        spin_unlock_irqrestore(&xhci->lock, flags);
 
        if (ret)
index ee7bc7ecbc595c98985eeca9f7e9fcfb7e16f677..d527710f6ef7a8dcd266fada48a2f2464f2ee959 100644 (file)
@@ -577,6 +577,8 @@ static void handle_stopped_endpoint(struct xhci_hcd *xhci,
                /* Otherwise just ring the doorbell to restart the ring */
                ring_ep_doorbell(xhci, slot_id, ep_index);
        }
+       ep->stopped_td = NULL;
+       ep->stopped_trb = NULL;
 
        /*
         * Drop the lock and complete the URBs in the cancelled TD list.
@@ -1049,8 +1051,13 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci,
        ep->ep_state |= EP_HALTED;
        ep->stopped_td = td;
        ep->stopped_trb = event_trb;
+
        xhci_queue_reset_ep(xhci, slot_id, ep_index);
        xhci_cleanup_stalled_ring(xhci, td->urb->dev, ep_index);
+
+       ep->stopped_td = NULL;
+       ep->stopped_trb = NULL;
+
        xhci_ring_cmd_db(xhci);
 }