[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200310124211.430808842@linuxfoundation.org>
Date: Tue, 10 Mar 2020 13:42:27 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Peter Chen <peter.chen@....com>,
Jack Pham <jackp@...eaurora.org>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Macpaul Lin <macpaul.lin@...iatek.com>
Subject: [PATCH 4.14 126/126] xhci: handle port status events for removed USB3 hcd
From: Mathias Nyman <mathias.nyman@...ux.intel.com>
commit 1245374e9b8340fc255fd51b2015173a83050d03 upstream.
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
Cc: <stable@...r.kernel.org>
Reported-by: Peter Chen <peter.chen@....com>
Tested-by: Jack Pham <jackp@...eaurora.org>
Signed-off-by: Mathias Nyman <mathias.nyman@...ux.intel.com>
Cc: Macpaul Lin <macpaul.lin@...iatek.com>
[redone for 4.14.y based on Mathias's comments]
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/usb/host/xhci-ring.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1640,6 +1640,12 @@ static void handle_port_status(struct xh
if ((major_revision == 0x03) != (hcd->speed >= HCD_USB3))
hcd = xhci->shared_hcd;
+ if (!hcd) {
+ xhci_dbg(xhci, "No hcd found for port %u event\n", port_id);
+ bogus_port_status = true;
+ goto cleanup;
+ }
+
if (major_revision == 0) {
xhci_warn(xhci, "Event for port %u not in "
"Extended Capabilities, ignoring.\n",
Powered by blists - more mailing lists