xhci: fix null pointer dereference in stop command timeout function
authorMathias Nyman <mathias.nyman@linux.intel.com>
Wed, 7 Sep 2016 14:26:33 +0000 (17:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Sep 2016 08:07:41 +0000 (10:07 +0200)
commit6267a54a24331b4ddee59ebf98c76e92cfed6719
tree3b2d136cdbd13e22501df33a75c48b65fc9a837d
parent8aa6a2a34fbb8f7a326c50ffc6738461798b5d77
xhci: fix null pointer dereference in stop command timeout function

commit bcf42aa60c2832510b9be0f30c090bfd35bb172d upstream.

The stop endpoint command has its own 5 second timeout timer.
If the timeout function is triggered between USB3 and USB2 host
removal it will try to call usb_hc_died(xhci_to_hcd(xhci)->primary_hcd)

the ->primary_hcd will be set to NULL at USB3 hcd removal.

Fix this by first checking if the PCI host is being removed, and
also by using only xhci_to_hcd() as it will always return the primary
hcd.

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