Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usbip: Accept arbitrarily long scatter-gather list

Fixes issue where memory will fail to be allocated for larger bulk
transfers, ~1 MB or more. This occurs because userland libraries, such
as libusb, send the entire USB data buffer when SG support is detected.
The assumption is that the driver knows how to properly split the data
up before sending it out.

By hardcoding a limit, bigger transfers that exceed the SG tablesize
limit of 32 will be unable to use SG. This results in an attempt to
allocate contiguous pages which, unsurprisingly, will fail too and
returns an ENOMEM. It looks like other drivers that support SG allow for
any length of SG lists. Accepting any SG size allows the driver to
properly handle large bulk transfer situations.

Tested bulk read and write operations using the following devices:

- Logitech Webcam Pro 9000 - USB 2.0
- SanDisk Ultra - USB 3.0
- Logitech M500s Mouse

Signed-off-by: Jason Long <jasonlongball@gmail.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20241218161344.202637-1-jasonlongball@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jason Long and committed by
Greg Kroah-Hartman
ca5d736b 8cda395b

+2 -6
+2 -6
drivers/usb/usbip/vhci_hcd.c
··· 1161 1161 hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; 1162 1162 } 1163 1163 1164 - /* 1165 - * Support SG. 1166 - * sg_tablesize is an arbitrary value to alleviate memory pressure 1167 - * on the host. 1168 - */ 1169 - hcd->self.sg_tablesize = 32; 1164 + /* accept arbitrarily long scatter-gather lists */ 1165 + hcd->self.sg_tablesize = ~0; 1170 1166 hcd->self.no_sg_constraint = 1; 1171 1167 1172 1168 return 0;