]> Git Repo - linux.git/commitdiff
usb: xhci: fix spinlock recursion for USB2 test mode
authorPeter Chen <[email protected]>
Thu, 20 Jul 2017 11:48:30 +0000 (14:48 +0300)
committerGreg Kroah-Hartman <[email protected]>
Thu, 20 Jul 2017 12:40:36 +0000 (14:40 +0200)
Both xhci_hub_control and xhci_disable_slot tries to hold spinlock, the
spinlock recursion occurs when enters USB2 test mode. Fix it by unlock
spinlock before calling xhci_disable_slot.

Cc: <[email protected]>
Fixes: 0f1d832ed1fb ("usb: xhci: Add port test modes support for usb2")
Signed-off-by: Peter Chen <[email protected]>
Signed-off-by: Mathias Nyman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/usb/host/xhci-hub.c

index 9ef5f68e32131c6bd969a92cc432eafd7204fe69..00721e8807ab472f1e886fff791e7bbbaeec3a13 100644 (file)
@@ -610,12 +610,14 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci,
 
        /* Disable all Device Slots */
        xhci_dbg(xhci, "Disable all slots\n");
+       spin_unlock_irqrestore(&xhci->lock, *flags);
        for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) {
                retval = xhci_disable_slot(xhci, NULL, i);
                if (retval)
                        xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n",
                                 i, retval);
        }
+       spin_lock_irqsave(&xhci->lock, *flags);
        /* Put all ports to the Disable state by clear PP */
        xhci_dbg(xhci, "Disable all port (PP = 0)\n");
        /* Power off USB3 ports*/
This page took 0.053425 seconds and 4 git commands to generate.