patch "xhci: fix null pointer dereference in stop command timeout function" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
xhci: fix null pointer dereference in stop command timeout function
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
bcf42aa60c2832510b9be0f30c090bfd35bb172dMon Sep 17 00:00:00 2001
From: Mathias Nyman <[email protected]>
Date: Wed, 7 Sep 2016 17:26:33 +0300
Subject: 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.
--- drivers/usb/host/xhci-ring.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +5 -1
@@ -850,6 +850,10 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)spin_lock_irqsave (&xhci->lock, flags); ep->stop_cmds_pending--; +if (xhci->xhc_state &XHCI_STATE_REMOVING ) { +spin_unlock_irqrestore (&xhci->lock, flags); +return ; + }if (xhci->xhc_state &XHCI_STATE_DYING ) {xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb, "Stop EP timer ran, but another timer marked "
@@ -903,7 +907,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)spin_unlock_irqrestore (&xhci->lock, flags);xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb,"Calling usb_hc_died()" ); -usb_hc_died (xhci_to_hcd (xhci)->primary_hcd); +usb_hc_died (xhci_to_hcd (xhci));xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb,"xHCI host controller is dead." ); }
Signature · 1 line
2.9.3