Skip to contentSkip to conversation

patch "xhci: handle port status events for removed USB3 hcd" added to usb-linus

PATCH [email protected] 1 participant 1 message Nov 10, 2018

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

xhci: handle port status events for removed USB3 hcd

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 1245374e9b8340fc255fd51b2015173a83050d03 Mon Sep 17 00:00:00 2001

From: Mathias Nyman <[email protected]>
Date: Fri, 9 Nov 2018 17:21:18 +0200
Subject: xhci: handle port status events for removed USB3 hcd

At xhci removal the USB3 hcd (shared_hcd) is removed before the primary USB2 hcd. Interrupts for port status changes may still occur for USB3 ports after the shared_hcd is freed, causing NULL pointer dereference.

Check if xhci->shared_hcd is still valid before handing USB3 port events

---
 drivers/usb/host/xhci-ring.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/usb/host/xhci-ring.c +7 -0
index a8d92c90fb58..80d464ea5a9a 100644
@@ -1556,6 +1556,13 @@ static void handle_port_status(struct xhci_hcd *xhci,
 		goto cleanup;
 	}
 
+	/* We might get interrupts after shared_hcd is removed */
+	if (port->rhub == &xhci->usb3_rhub && xhci->shared_hcd == NULL) {
+		xhci_dbg(xhci, "ignore port event for removed USB3 hcd\n");
+		bogus_port_status = true;
+		goto cleanup;
+	}
+
 	hcd = port->rhub->hcd;
 	bus_state = &xhci->bus_state[hcd_index(hcd)];
 	hcd_portnum = port->hcd_portnum;
Signature · 1 line
2.19.1