From: Palla Raghunath <raghunathpalla.0209@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, "Neill Kapron" <nkapron@google.com>,
"Michał Nazarewicz" <mina86@mina86.com>,
"Shuangpeng Bai" <shuangpeng.kernel@gmail.com>,
"Shuah Khan" <shuah@kernel.org>,
"Brigham Campbell" <me@brighamcampbell.com>,
linux-kernel-mentees@lists.linux.dev,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
syzbot+6227549bd2c8a1ec8ba0@syzkaller.appspotmail.com,
raghunathpalla.0209@gmail.com
Subject: Re: [PATCH v2] usb: gadget: f_fs: fix use-after-free of ffs_dev in ffs_free_inst()
Date: Fri, 4 Dec 2026 05:50:55 +0000 [thread overview]
Message-ID: <20261204055055.42724-1-raghunathpalla.0209@gmail.com> (raw)
In-Reply-To: <2026120350-conjuror-width-14d5@gregkh>
On Thu, Dec 03, 2026 at 11:16:58PM +0100, Greg Kroah-Hartman wrote:
> Isn't this fixed cleaner by:
> https://lore.kernel.org/r/20261120210616.2293426-1-shuangpeng.kernel@gmail.com
>
> If not, please resend and explain why that commit does not fix this
> issue.
I don't think it does. They are two different bugs on two different
objects.
Shuangpeng's patch is about struct ffs_data. ffs_func_unbind() drops
its reference with functionfs_unbind() and then still takes
ffs->eps_lock, so the patch moves functionfs_unbind() to the end. It
only changes ffs_func_unbind().
This one is about struct ffs_dev. In the syzbot report the freed object
was allocated in ffs_alloc_inst() and freed from ffs_free_inst():
Freed by task 17408:
_ffs_free_dev drivers/usb/gadget/function/f_fs.c:4336 [inline]
ffs_free_inst+0x233/0x2c0 drivers/usb/gadget/function/f_fs.c:4152
ffs_free_inst() drops ffs_dev_lock between ffs_release_dev() and
_ffs_free_dev(), and the dev is still on ffs_devices in that window. A
mount with the same name can pick it up through ffs_acquire_dev(), and
the umount later writes to the freed dev in ffs_closed().
No gadget bind or unbind is involved. ffs_func_unbind() isn't in the
syzbot report, and my reproducer only races configfs mkdir/rmdir of
the function against mount/umount of functionfs, without ever binding
a UDC. Shuangpeng's patch doesn't touch ffs_free_inst(), so that window
is still there with it applied.
I'll resend v2 with this explanation below the --- line.
thanks,
Raghunath
prev parent reply other threads:[~2026-12-04 5:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 23:07 Palla Raghunath
2026-12-03 22:16 ` Greg Kroah-Hartman
2026-12-04 5:50 ` Palla Raghunath [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=20261204055055.42724-1-raghunathpalla.0209@gmail.com \
--to=raghunathpalla.0209@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=me@brighamcampbell.com \
--cc=mina86@mina86.com \
--cc=nkapron@google.com \
--cc=shuah@kernel.org \
--cc=shuangpeng.kernel@gmail.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+6227549bd2c8a1ec8ba0@syzkaller.appspotmail.com \
/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®