usb: xhci: fix return value of xhci_setup_device()
Subsystems (3)
PATCH v2 1/1 usb: xhci: fix return value of xhci_setup_device()
xhci_setup_device() should return failure with correct error number when xhci host has died, removed or halted.
---
v1->v2:
- fix email mismatch issue
drivers/usb/host/xhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +3 -1
@@ -3785,8 +3785,10 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,mutex_lock (&xhci->mutex); -if (xhci->xhc_state)/* dying, removing or halted */ +if (xhci->xhc_state) {/* dying, removing or halted */ + ret = -ESHUTDOWN ; goto out; + }if (!udev->slot_id) { xhci_dbg_trace(xhci, trace_xhci_dbg_address,
Signature · 1 line
2.1.4
Greg KH
maintainerQuoted 4 lines · Lu Baolu
xhci_setup_device()should return failure with correct error number when xhci host has died, removed or halted.Cc [email protected] # 4.3+
Why is this a stable kernel issue? What bug does it fix that affects users?
thanks,
greg k-h
Hi Greg,
Quoted 7 lines · Greg KH
Quoted 4 lines · Lu Baolu
xhci_setup_device()should return failure with correct error number when xhci host has died, removed or halted.Cc [email protected] # 4.3+Why is this a stable kernel issue? What bug does it fix that affects users?
During usb device enumeration, if xhci host is not accessible (died, removed or halted), the hc_driver->address_device() should return a corresponding error code to usb core. But current xhci driver just returns success. This will mislead usb core to continue enumeration:
reading device descriptor, which will result in failure, and users will get a misleading message like "device descriptor read/8, error -110".
Best regards,
Lu Baolu
Greg KH
maintainerQuoted 11 lines · Lu Baolu
Hi Greg,
Quoted 7 lines · Greg KH
Quoted 4 lines · Lu Baolu
xhci_setup_device()should return failure with correct error number when xhci host has died, removed or halted.Cc [email protected] # 4.3+Why is this a stable kernel issue? What bug does it fix that affects users?
Quoted 6 lines
During usb device enumeration, if xhci host is not accessible (died, removed or halted), the
hc_driver->address_device()should return a corresponding error code to usb core. But current xhci driver just returns success. This will mislead usb core to continue enumeration:
reading device descriptor, which will result in failure, and users will get a misleading message like "device descriptor read/8, error -110".
Why didn't you include this in the changelog text so that it is obvious why this patch is needed?
Don't just describe what the patch does, we can read C code, describe _why_ it is needed.
thanks,
greg k-h
Hi Greg,
Quoted 17 lines · Greg KH
Quoted 8 lines · Lu Baolu
Hi Greg,
Quoted 5 lines · Greg KH
Quoted 4 lines · Lu Baolu
xhci_setup_device()should return failure with correct error number when xhci host has died, removed or halted.Cc [email protected] # 4.3+Quoted 8 lines
Quoted 2 lines
Why is this a stable kernel issue? What bug does it fix that affects users?
During usb device enumeration, if xhci host is not accessible (died, removed or halted), the
hc_driver->address_device()should return a corresponding error code to usb core. But current xhci driver just returns success. This will mislead usb core to continue enumeration:
reading device descriptor, which will result in failure, and users will get a misleading message like "device descriptor read/8, error -110".
Quoted 5 lines
Why didn't you include this in the changelog text so that it is obvious why this patch is needed?
Don't just describe what the patch does, we can read C code, describe _why_ it is needed.
Yes. Thank you for the guidance. I will do it in a v3 patch.
Best regards,
Lu Baolu