[PATCH 0/2] usb: fix over-reported actual_length in usbip/usbfs

From: Cheng Yongkang

Date: Thu Oct 29 2026 - 10:20:06 EST


The usbip vhci receive error path gives a failed URB back with the
peer-supplied actual_length, and usbfs copy_urb_data_to_user() trusts
that length for non-isochronous URBs. A malicious usbip peer can make
usbfs read past the transfer buffer.

Patch 1 clears actual_length on the vhci receive failure path. Patch 2
clamps the copied length to transfer_buffer_length in usbfs as a
defense-in-depth measure for any HCD that violates the actual_length
contract.

Cheng Yongkang (2):
usbip: clear actual_length after a failed receive
usb: usbfs: clamp the copied length to transfer_buffer_length

drivers/usb/core/devio.c | 7 +++++--
drivers/usb/usbip/vhci_rx.c | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)

--
2.34.1