Skip to content

usb: fix over-reported actual_length in usbip/usbfs

Cheng Yongkang linux-usb lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2usbip: clear actual_length after a failed receivedrivers/usb/usbip/vhci_rx.c+1 -06 replies
2/2usb: usbfs: clamp the copied length to transfer_buffer_lengthdrivers/usb/core/devio.c+5 -21 reply

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchShuah Khan
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

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

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(-)
Signature · 1 line
2.34.1