From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>, linux-usb@vger.kernel.org
Cc: target-devel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: f_tcm: put the overlapped command's request back on ep_cmd
Date: Thu, 19 Nov 2026 14:21:37 +0000 [thread overview]
Message-ID: <sashiko-outbox-223285@kernel.org> (raw)
In-Reply-To: <20261119140641.2768465-1-yhlee@isslab.korea.ac.kr>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] usb: gadget: f_tcm: NULL pointer dereference in
usbg_aborted_task() [1]
--
commit 8fc2b5f7f30651e73e59207af565a062eb0d398b
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
usb: gadget: f_tcm: put the overlapped command's request back on ep_cmd
This commit requeues the USB request of a duplicate overlapped command on
ep_cmd before returning its tag slot to the session tag pool in
usbg_cmd_work().
> diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c
> index 9e6d4f39900a2..4dcf2ba008384 100644
> --- a/drivers/usb/gadget/function/f_tcm.c
> +++ b/drivers/usb/gadget/function/f_tcm.c
[ ... ]
> @@ -1333,6 +1340,8 @@ static void usbg_cmd_work(struct work_struct *work)
> active_cmd->tmr_rsp = RC_OVERLAPPED_TAG;
> usbg_aborted_task(&active_cmd->se_cmd);
>
> + usb_ep_queue(fu->ep_cmd, req, GFP_ATOMIC);
[Severity: Critical]
This problem wasn't introduced by this patch, but can usbg_aborted_task()
dereference a NULL stream->req_out pointer in Bulk-Only Transport (BOT)
mode [1]?
The target core also registers usbg_aborted_task() as the .aborted_task
callback and invokes it on task abort sequences such as a LUN reset.
Because stream requests are only allocated for UAS mode, stream->req_out
remains NULL in BOT mode:
drivers/usb/gadget/function/f_tcm.c:usbg_aborted_task() {
...
struct uas_stream *stream = &fu->stream[se_cmd->map_tag];
int ret = 0;
if (stream->req_out->status == -EINPROGRESS)
ret = usb_ep_dequeue(fu->ep_out, stream->req_out);
...
}
Aborting a task in BOT mode therefore causes a NULL pointer dereference and
kernel panic.
[1] https://sashiko.dev/#/bug/linux-02bb90fe-74db-45ad-a2cf-107fe1a41bc4
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119140641.2768465-1-yhlee@isslab.korea.ac.kr?part=1
prev parent reply other threads:[~2026-11-19 14:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 14:06 [PATCH] usb: gadget: f_tcm: put the overlapped command's request back on ep_cmd Yehyeong Lee
2026-11-19 14:21 ` 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-223285@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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