Re: [PATCH] usb: storage: shuttle_usbat: clamp device-reported read length

From: Artem Dinaburg

Date: Tue Dec 01 2026 - 15:25:03 EST


On Sun, Aug 23, 2026 at 03:47:28AM +0800, Haofeng Li wrote:
> + /* Device-controlled; clamp to the command buffer to avoid OOB DMA */
> + if (len > scsi_bufflen(srb))
> + len = scsi_bufflen(srb);

I rediscovered this issue independently, with AI assistance, and was
glad to see there was already a patch for it. In my opinion it would be
better to report a transport error here instead of silently reading a
part of the response:

if (len > scsi_bufflen(srb))
return USB_STOR_TRANSPORT_ERROR;

Combined with other bugs, this one can lead to kernel code execution,
so it would be good to get it applied. It has had no response since
August, is not in mainline (19cc08c1a6a6) or usb-next as of today, and
still applies to usb-next with an offset.

The patch could carry:

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@xxxxxxxxxxxxxxx