From: Dominique Martinet <asmadeus@codewreck.org>
To: Chengfeng Ye <nicoyip.dev@gmail.com>
Cc: Eric Van Hensbergen <ericvh@kernel.org>,
Latchesar Ionkov <lucho@ionkov.net>,
Christian Schoenebeck <linux_oss@crudebyte.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Grzeschik <mgr@kernel.org>,
v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] net/9p/usbg: fix descriptor cleanup use-after-free
Date: Sun, 13 Sep 2026 17:29:37 +0900 [thread overview]
Message-ID: <aqZe8Y564O2ubaiu@codewreck.org> (raw)
In-Reply-To: <20260731150414.3135662-1-nicoyip.dev@gmail.com>
Chengfeng Ye wrote on Fri, Jul 31, 2026 at 11:04:14PM +0800:
> usb9pfs_free_func() frees the f_usb9pfs object before calling
> usb_free_all_descriptors(). The usb_function passed to the latter is
> embedded in the freed object, so removing the function from a gadget
> dereferences freed memory.
>
> The failing teardown sequence is:
>
> configfs unlink
> usb9pfs_free_func()
> kfree(usb9pfs)
> usb_free_all_descriptors(f)
> dereference the embedded usb_function
>
> KASAN reported:
>
> BUG: KASAN: slab-use-after-free in usb_free_all_descriptors+0x138/0x190
> Read of size 8 at addr ffff888106a73088 by task poc/95
> Call Trace:
> usb_free_all_descriptors+0x138/0x190
> config_usb_cfg_unlink+0x1f0/0x2f0
> configfs_unlink+0x321/0x6f0
>
> Free the descriptors before freeing their containing object.
>
> Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport")
> Cc: stable@vger.kernel.org
> Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Thanks for the patch, given there was another identical patch earlier
but Michael preferred your commit message I've kept the original patch
with your commit message, keeping you as Co-developed-by
It should get in 7.4 if I'm not hit by a bus
other mail
https://lore.kernel.org/r/20260529081817.77898-1-zhaoyz24@mails.tsinghua.edu.cn
commit as of now
https://github.com/martinetd/linux/commit/0955472fff1e9f9e410a0300136924ebc8bd7a16
(look in https://github.com/martinetd/linux/commits/9p-test if commit is
gone on rebase)
--
Dominique Martinet | Asmadeus
prev parent reply other threads:[~2026-09-13 8:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 15:04 Chengfeng Ye
2026-08-11 14:49 ` Michael Grzeschik
2026-09-13 8:29 ` Dominique Martinet [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=aqZe8Y564O2ubaiu@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=ericvh@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=mgr@kernel.org \
--cc=nicoyip.dev@gmail.com \
--cc=stable@vger.kernel.org \
--cc=v9fs@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
all inboxes | Powered by JetHome®