xhci: Fix null pointer dereference in resume if xhci has only one roothub
authorMathias Nyman <mathias.nyman@linux.intel.com>
Fri, 10 Jun 2022 11:53:38 +0000 (14:53 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jun 2022 11:57:20 +0000 (13:57 +0200)
commit802dcafc420af536fcde1b44ac51ca211f4ec673
tree9a50af44f07f0296824a890f88c2a6c5ae10dd1c
parent8bd6b8c4b1009d7d2662138d6bdc6fe58a9274c5
xhci: Fix null pointer dereference in resume if xhci has only one roothub

In the re-init path xhci_resume() passes 'hcd->primary_hcd' to hci_init(),
however this field isn't initialized by __usb_create_hcd() for a HCD
without secondary controller.

xhci_resume() is called once per xHC device, not per hcd, so the extra
checking for primary hcd can be removed.

Fixes: e0fe986972f5 ("usb: host: xhci-plat: prepare operation w/o shared hcd")
Reported-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20220610115338.863152-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci.c