From: Greg KH <gregkh@linuxfoundation.org>
To: Olivier Kaloudoff <olivier.kaloudoff@gmail.com>
Cc: linux-usb@vger.kernel.org, oneukum@suse.com,
stern@rowland.harvard.edu, linux-scsi@vger.kernel.org,
usb-storage@lists.one-eyed-alien.net, stable@vger.kernel.org
Subject: Re: [PATCH] usb: uas: validate status URB length before parsing the IU
Date: Wed, 14 Oct 2026 06:59:28 +0200 [thread overview]
Message-ID: <2026101453-worry-arose-6024@gregkh> (raw)
In-Reply-To: <20261013221937.41490-1-olivier.kaloudoff@gmail.com>
On Wed, Oct 14, 2026 at 12:19:37AM +0200, Olivier Kaloudoff wrote:
> uas_stat_cmplt() dereferences iu->tag without verifying that the
> status URB actually carried a full IU header. The transfer buffer is
> a freshly-zeroed sense_iu, so a status URB that completes
> successfully but with a short or empty actual_length — observed in
> the wild during link-level upsets (Thunderbolt-chain xhci blips) and
> on a wedging bridge — reads back as iu_id=0/tag=0 and produces the
> misleading
>
> stat urb: no pending cmd for uas-tag 0
>
> log spam seen e.g. on an ASMT135x enclosure and a Samsung T7, right
> before the affected commands time out into the error handler.
>
> Beyond the noise, a short packet that happens to carry a
> plausible-looking header could be matched to an inflight command and
> drive the state machine off garbage. Bail out on anything shorter
> than a full struct iu.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Olivier Kaloudoff <olivier.kaloudoff@gmail.com>
> ---
> drivers/usb/storage/uas.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
> index 265162981269..88fed50c262b 100644
> --- a/drivers/usb/storage/uas.c
> +++ b/drivers/usb/storage/uas.c
> @@ -315,6 +315,13 @@ static void uas_stat_cmplt(struct urb *urb)
> goto bail;
> }
>
> + if (urb->actual_length < sizeof(struct iu)) {
> + dev_err(&urb->dev->dev,
> + "stat urb: short transfer (%u bytes)\n",
> + urb->actual_length);
Do not allow broken / malicious devices to spam the kernel log.
And how was this tested?
thanks,
greg k-h
next prev parent reply other threads:[~2026-10-14 4:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 22:19 [PATCH] usb: uas: validate status URB length before parsing the IU Olivier Kaloudoff
2026-10-14 4:59 ` Greg KH [this message]
2026-10-14 10:55 ` [PATCH v2] " Olivier Kaloudoff
2026-10-14 11:09 ` sashiko-bot
2026-10-14 16:56 ` [PATCH v3] " Olivier Kaloudoff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026101453-worry-arose-6024@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=olivier.kaloudoff@gmail.com \
--cc=oneukum@suse.com \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=usb-storage@lists.one-eyed-alien.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox