xhci: handle port status events for removed USB3 hcd
authorMathias Nyman <mathias.nyman@linux.intel.com>
Fri, 9 Nov 2018 15:21:18 +0000 (17:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 1 Dec 2018 08:37:25 +0000 (09:37 +0100)
commita237717dfdbc5e6f7cd9d5b2d66627ad793bb8cf
tree2273d4a44179889b645546846f1e8c91eda03c24
parent82c1b66894fd3b81af823861a39d532af4337f4e
xhci: handle port status events for removed USB3 hcd

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@vger.kernel.org>
Reported-by: Peter Chen <peter.chen@nxp.com>
Tested-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c