xhci: fix finding correct bus_state structure for USB 3.1 hosts
authorMathias Nyman <mathias.nyman@linux.intel.com>
Mon, 18 Sep 2017 14:39:13 +0000 (17:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Sep 2017 15:10:41 +0000 (17:10 +0200)
xhci driver keeps a bus_state structure for each hcd (usb2 and usb3)

The structure is picked based on hcd speed, but driver only compared
for HCD_USB3 speed, returning the wrong bus_state for HCD_USB31 hosts.

This caused null pointer dereference errors in bus_resume function.

Cc: <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci.h

index 2abaa4d6d39daa74ff379020171efaf34a7e9197..e96e90d0fe9ffd97cbd59b38c07694bbf226e896 100644 (file)
@@ -1681,7 +1681,7 @@ struct xhci_bus_state {
 
 static inline unsigned int hcd_index(struct usb_hcd *hcd)
 {
-       if (hcd->speed == HCD_USB3)
+       if (hcd->speed >= HCD_USB3)
                return 0;
        else
                return 1;