From: Greg KH <gregkh@linuxfoundation.org>
To: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Cc: nkapron@google.com, linux-usb@vger.kernel.org,
Thinh.Nguyen@synopsys.com, bigeasy@linutronix.de,
target-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
benquike@gmail.com
Subject: Re: [PATCH v8 2/4] usb: gadget: f_tcm: zero the CBW buffer the status path sends
Date: Fri, 20 Nov 2026 11:55:22 +0100 [thread overview]
Message-ID: <2026112008-parakeet-unblessed-17ed@gregkh> (raw)
In-Reply-To: <20261118124005.2428068-3-yhlee@isslab.korea.ac.kr>
On Wed, Nov 18, 2026 at 09:40:03PM +0900, Yehyeong Lee wrote:
> bot_prepare_reqs() allocates fu->cmd[0].buf with kmalloc(), one endpoint
> maxpacket in size, and the only thing ever written into it is the 31-byte
> CBW the host sends. The rest is never initialised.
>
> When a command is rejected before its data stage, bot_send_bad_status()
> points the status request at that same buffer and queues it to the IN
> endpoint for a read, and bot_err_compl() re-queues it until the length the
> host declared in the CBW is satisfied. So the host gets the buffer's
> contents back, a maxpacket at a time, for as long a transfer as it asked
> for, and whatever lies past the CBW it never wrote.
>
> Allocate it with kzalloc().
>
> On a dummy_hcd gadget with a 512-byte bulk maxpacket, a rejected IN
> command declaring 4096 bytes returns 4096 bytes to the host, of which 72
> are non-zero and begin with the previous CBW's "USBC" signature. The
> part no CBW ever writes read back as zero there, both before and after
> this patch, so what that buffer held beforehand was not observed; what
> the test does show is that the host is handed a buffer it only ever
> wrote 31 bytes of.
>
> Hui Peng's multi-driver fix of 2026-09-19 zeroed this buffer too; the
> reviewer asked for it to be split per driver and it was not applied.
Why is this line in the changelog? It shouldn't be.
next prev parent reply other threads:[~2026-11-20 10:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 12:40 [PATCH v8 0/4] usb: gadget: f_tcm: fix infoleaks, sleep, and UAF in the BOT path Yehyeong Lee
2026-11-18 12:40 ` [PATCH v8 1/4] usb: gadget: f_tcm: queue the BOT status requests with GFP_ATOMIC Yehyeong Lee
2026-11-18 12:40 ` [PATCH v8 2/4] usb: gadget: f_tcm: zero the CBW buffer the status path sends Yehyeong Lee
2026-11-20 10:55 ` Greg KH [this message]
2026-11-20 11:32 ` Yehyeong Lee
2026-11-18 12:40 ` [PATCH v8 3/4] usb: gadget: f_tcm: reject a short write data-out transfer Yehyeong Lee
2026-11-18 12:40 ` [PATCH v8 4/4] usb: gadget: f_tcm: clear the scatter list when reusing the BOT status request Yehyeong Lee
2026-11-20 10:55 ` Greg KH
2026-11-20 11:32 ` Yehyeong Lee
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=2026112008-parakeet-unblessed-17ed@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=Thinh.Nguyen@synopsys.com \
--cc=benquike@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nkapron@google.com \
--cc=target-devel@vger.kernel.org \
--cc=yhlee@isslab.korea.ac.kr \
/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
all inboxes | Powered by JetHome®