Skip to contentSkip to conversation

patch "usb: xhci: fix spinlock recursion for USB2 test mode" added to usb-linus

PATCH [email protected] 1 participant 1 message Jul 20, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: xhci: fix spinlock recursion for USB2 test mode

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 576d55460e7f209139545a348746c2fcadf61bc3 Mon Sep 17 00:00:00 2001

From: Peter Chen <[email protected]>
Date: Thu, 20 Jul 2017 14:48:30 +0300
Subject: usb: xhci: fix spinlock recursion for USB2 test mode

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.

Fixes 0f1d832ed1fb ("usb: xhci: Add port test modes support for usb2")
---
 drivers/usb/host/xhci-hub.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-hub.c +2 -0
index 9ef5f68e3213..00721e8807ab 100644
@@ -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*/
Signature · 1 line
2.13.3