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

From: Alan Stern

Date: Tue Dec 01 2026 - 15:55:19 EST


On Tue, Dec 01, 2026 at 03:24:46PM -0500, Artem Dinaburg wrote:
> 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

Sometimes things just get overlooked; there have been an awful lot of
patches submitted in the last few months.

Okay, if you want to submit a new patch for this (perhaps giving credit
to Haofeng for his earlier discovery), go right ahead. This time I
won't ignore it.

Alan Stern