Skip to content

Commit dc92944

Browse files
Henry Lingregkh
authored andcommitted
xhci: stop polling roothubs after shutdown
While rebooting, XHCI controller and its bus device will be shut down in order by .shutdown callback. Stopping roothubs polling in xhci_shutdown() can prevent XHCI driver from accessing port status after its bus device shutdown. Take PCIe XHCI controller as example, if XHCI driver doesn't stop roothubs polling, XHCI driver may access PCIe BAR register for port status after parent PCIe root port driver is shutdown and cause PCIe bus error. [check shared hcd exist before stopping its roothub polling -Mathias] Cc: stable@vger.kernel.org Signed-off-by: Henry Lin <henryl@nvidia.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20220408134823.2527272-3-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e91ac20 commit dc92944

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/usb/host/xhci.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,17 @@ void xhci_shutdown(struct usb_hcd *hcd)
781781
if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
782782
usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev));
783783

784+
/* Don't poll the roothubs after shutdown. */
785+
xhci_dbg(xhci, "%s: stopping usb%d port polling.\n",
786+
__func__, hcd->self.busnum);
787+
clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
788+
del_timer_sync(&hcd->rh_timer);
789+
790+
if (xhci->shared_hcd) {
791+
clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
792+
del_timer_sync(&xhci->shared_hcd->rh_timer);
793+
}
794+
784795
spin_lock_irq(&xhci->lock);
785796
xhci_halt(xhci);
786797
/* Workaround for spurious wakeups at shutdown with HSW */

0 commit comments

Comments
 (0)