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 4/4] usb: gadget: f_tcm: clear the scatter list when reusing the BOT status request
Date: Fri, 20 Nov 2026 11:55:56 +0100 [thread overview]
Message-ID: <2026112046-thirstily-cosmetics-1aca@gregkh> (raw)
In-Reply-To: <20261118124005.2428068-5-yhlee@isslab.korea.ac.kr>
On Wed, Nov 18, 2026 at 09:40:05PM +0900, Yehyeong Lee wrote:
> bot_send_bad_status() reuses fu->bot_req_in/bot_req_out to send the CSW or
> drain the data phase, but a preceding sg command left req->sg and
> req->num_sgs pointing at that command's t_data_sg - set in
> bot_send_read_response() for a read, or usbg_prepare_w_request() for a
> write. That command is freed before the status request runs, so on an
> sg-capable UDC the status request is handed to the controller with a freed
> scatter list: the controller reads freed memory out to the host on an IN
> endpoint, or writes host data into it on an OUT endpoint.
>
> Clear req->num_sgs and req->sg so the UDC uses the linear req->buf instead.
>
> A test module that stands in for the controller's queue path, so that it
> dereferences req->sg the way an sg-capable UDC would, reports a KASAN
> slab-use-after-free on the freed entry for a read command followed by a
> rejected command that reuses bot_req_in: 20 runs out of 20 without this
> patch and 0 out of 20 with it. A normal sg read still queues its own
> scatter list.
Why is this paragraph here? What does it mean?
prev parent reply other threads:[~2026-11-20 10:55 UTC|newest]
Thread overview: 11+ 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:43 ` sashiko-bot
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-18 12:45 ` sashiko-bot
2026-11-20 10:55 ` Greg KH
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:59 ` sashiko-bot
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-18 12:46 ` sashiko-bot
2026-11-20 10:55 ` Greg KH [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=2026112046-thirstily-cosmetics-1aca@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