From: sashiko-bot@kernel.org
To: "Artem Dinaburg" <artem@trailofbits.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2] usb: core: reject SG URBs longer than their scatterlist
Date: Wed, 02 Dec 2026 04:19:00 +0000 [thread overview]
Message-ID: <sashiko-outbox-244838@kernel.org> (raw)
In-Reply-To: <20261202041214.97186-1-artem@trailofbits.com>
> A bulk or interrupt URB that uses a scatterlist can request more bytes
> than the scatterlist covers. usb_sg_init() copies its caller's length
> into transfer_buffer_length without comparing it to the scatterlist,
> and usb_submit_urb() does not check it either. xhci-hcd queues TRBs
> until the requested length is reached; after the final entry it
> continues from the last DMA address and length, so the controller
> transfers data outside the mapping. A USB device can cause this
> mismatch.
>
> Reject such URBs in usb_submit_urb() so that every HCD is covered. The
> existing scatter-gather check is skipped when the bus has no SG
> constraint, as is the case for xHCI, so sum the entry lengths for every
> SG URB and keep the maxpacket check conditional.
>
> Found and fixed with AI assistance.
>
> Suggested-by: Alan Stern <stern@rowland.harvard.edu>
> Fixes: 86065c2719a5 ("xhci: don't rely on precalculated value of needed trbs in the enqueue loop")
> Cc: stable@vger.kernel.org
> Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202041214.97186-1-artem@trailofbits.com?part=1
prev parent reply other threads:[~2026-12-02 4:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 4:12 [PATCH v2] usb: core: reject SG URBs longer than their scatterlist Artem Dinaburg
2026-12-02 4:19 ` sashiko-bot [this message]
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=sashiko-outbox-244838@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=artem@trailofbits.com \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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