Skip to contentSkip to conversation

usbcore: NULL pointer dereference after detaching USB disk with linux 4.17

DISCUSSION Mathias Nyman 1 participant 1 message May 14, 2018 USB

lore
Share & tools
lore
#0 lore raw
Quoted 31 lines · Jordan Glover
Quoted 30 lines · Mathias Nyman

I think that just adding the below code should be enough for 4.17

drivers/usb/host/xhci-hub.c +0 -0

index 72ebbc9..32cd52c 100644

--- a/drivers/usb/host/xhci-hub.c

+++ b/drivers/usb/host/xhci-hub.c

drivers/usb/host/xhci-hub.c +0 -2
@@ -354,7 +354,7 @@ int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
 
 slot_id = 0;
 
 for (i = 0; i < MAX_HC_SLOTS; i++) {
 
-                 if (!xhci->devs[i])
 
 
 
-                 if (!xhci->devs[i] || !xhci->devs[i]->udev)
 
                            continue;
                    speed = xhci->devs[i]->udev->speed;
 
                    if (((speed >= USB_SPEED_SUPER) == (hcd->speed >= HCD_USB3))
Quoted 5 lines
Quoted 1 line

-Mathias

I can confirm that above patch fixes this. I saw that offending commit was backported to 4.16.8 so it needs this fix as well. Thank you. ​

Thanks, sent patch.
Added stable tags and Reported-by/Tested-by: tags

-Mathias
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html