Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Slawomir Stepien" <sst@poczta.fm>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v3] usb: gadget: f_tcm: take the TPG in tcm_bind() instead of tcm_alloc()
Date: Fri, 04 Dec 2026 07:58:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-249351@kernel.org> (raw)
In-Reply-To: <20261204073332.1657586-1-sst@poczta.fm>

> tcm_alloc() runs when a TCM function is symlinked into a gadget
> configuration. It searches tpg_instances[] for the function instance
> and copies the TPG pointer into fu->tpg at that point, under
> tpg_instances_lock, and fu->tpg is never updated afterwards.
> 
> The function and the TPG can be set up in either order. If the
> function is linked into a configuration before the TPG directory is
> created, fu->tpg stays NULL. Creating and enabling the TPG afterwards
> lets tcm_bind() succeed, and the first USB request that reaches the
> target code dereferences the NULL fu->tpg. Likewise, if the TPG is
> removed (usbg_drop_tpg() detaches the gadget first) and a new one
> is created and enabled, the next bind keeps using the freed TPG.
> 
> Store the TPG in struct f_tcm_opts instead: set it in usbg_make_tpg(),
> clear it in usbg_drop_tpg() and copy it into fu->tpg in tcm_bind().
> [ ... ]
> Cc: stable@vger.kernel.org
> Reported-by: syzbot+2799146a53c356f8017d@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=2799146a53c356f8017d
> Link: https://syzkaller.appspot.com/ai_job?id=51e1f189-6d91-4321-a6ba-07d4eb3cd8cd
> Signed-off-by: Slawomir Stepien <sst@poczta.fm>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204073332.1657586-1-sst@poczta.fm?part=1

      reply	other threads:[~2026-12-04  7:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  7:33 [PATCH v3] usb: gadget: f_tcm: take the TPG in tcm_bind() instead of tcm_alloc() Slawomir Stepien
2026-12-04  7:58 ` 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-249351@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sst@poczta.fm \
    /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