UPSTREAM: 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)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 28 Oct 2016 03:31:57 +0000 (11:31 +0800)
commit37e579ab46f0d2e97fbff22a43a976caf21baca3
tree31e7c5e7b353627b739a240ba645c4011170dd57
parent59fedde0b227a5260c7cd4bd62cd01bd09264d12
UPSTREAM: xhci: fix null pointer dereference in stop command timeout function

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.

CC: <stable@vger.kernel.org>
Change-Id: Id8489b9ac57e08c7c696a06c7d6fe312ba393f6a
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit bcf42aa60c2832510b9be0f30c090bfd35bb172d)
drivers/usb/host/xhci-ring.c