usbip: host: ignore number_of_packets for non-isoc URBs - #7572
Open
zjzhao-eda wants to merge 1 commit into
Open
Conversation
number_of_packets is only meaningful for isochronous URBs. The USB/IP stub currently copies the value from the CMD_SUBMIT PDU into the local URB verbatim for all endpoint types. Some clients (e.g. usbip-win) leave number_of_packets uninitialized for non-isoc URBs, so a garbage/huge value reaches usb_submit_urb(). Host controllers that size per-URB allocations by this field (e.g. dwc2's dwc2_hcd_urb_alloc(), which always sizes the iso descriptor array by urb->number_of_packets) then attempt a multi-gigabyte allocation that fails with -ENOMEM, making usbip-host reset the device in an endless loop (older dwc_otg crashes outright instead). Sanitize number_of_packets to 0 for non-isochronous endpoints in the stub. This is a strict no-op for well-behaved clients (Linux vhci already sends 0 for non-isoc URBs) and fixes the dwc2/dwc_otg failures. Signed-off-by: zjzhao-eda <zjzhao@edatec.cn>
Contributor
|
This is a bug in unmodified upstream code. In the first instance you should submit this to the linux-usb list, following their patch submission guidelines. Once the patch is accepted upstream, we can merge it here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
number_of_packets is only meaningful for isochronous URBs. The USB/IP stub currently copies the value from the CMD_SUBMIT PDU into the local URB verbatim for all endpoint types.
Some clients (e.g. usbip-win) leave number_of_packets uninitialized for non-isoc URBs, so a garbage/huge value reaches usb_submit_urb(). Host controllers that size per-URB allocations by this field (e.g. dwc2's dwc2_hcd_urb_alloc(), which always sizes the iso descriptor array by urb->number_of_packets) then attempt a multi-gigabyte allocation that fails with -ENOMEM, making usbip-host reset the device in an endless loop (older dwc_otg crashes outright instead).
Sanitize number_of_packets to 0 for non-isochronous endpoints in the stub. This is a strict no-op for well-behaved clients (Linux vhci already sends 0 for non-isoc URBs) and fixes the dwc2/dwc_otg failures.