From: sashiko-bot@kernel.org
To: "Izaac Chong" <izaacchong934@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2 1/2] configfs: fix use-after-free of default group in configfs_symlink()
Date: Sat, 14 Nov 2026 05:57:00 +0000 [thread overview]
Message-ID: <sashiko-outbox-214194@kernel.org> (raw)
In-Reply-To: <20261114-configfs-symlink-uaf-v2-1-48c9cf068a91@gmail.com>
> configfs_symlink() drops the parent directory's inode lock while it
> resolves the link target, and keeps a reference to parent_item across
> that window. When the parent is a default group, such as
> ports/<n>/subsystems/ in the NVMe target, parent_item is embedded in
> the containing object (struct nvmet_port). A reference on the embedded
> item does not keep the containing object alive, so a concurrent rmdir of
> the port can free it. allow_link() and the final config_item_put() then
> touch freed memory:
>
> BUG: KASAN: slab-use-after-free in nvmet_port_subsys_allow_link+0x41/0x2e0
> Call Trace:
> nvmet_port_subsys_allow_link+0x41/0x2e0 drivers/nvme/target/configfs.c:1059
> configfs_symlink+0x59a/0x1030 fs/configfs/symlink.c:196
> vfs_symlink+0x18b/0x330 fs/namei.c:5794
>
> detach_groups() marks a default group's directory S_DEAD while holding
> that directory's inode lock, before the containing object can be freed.
> So drop the parent_item reference before unlocking dir, and after
> re-taking the lock return -ENOENT if dir is dead. Otherwise look
> parent_item up again, which is safe while dir is locked and alive.
>
> Fixes: 351e5d869e5a ("configfs: fix a deadlock in configfs_symlink()")
> Reported-by: syzbot+b0996ac2197dd7420c3e@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=b0996ac2197dd7420c3e
> Cc: linux-nvme@lists.infradead.org
> Signed-off-by: Izaac Chong <izaacchong934@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261114-configfs-symlink-uaf-v2-0-48c9cf068a91@gmail.com?part=1
next prev parent reply other threads:[~2026-11-14 5:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 5:29 [PATCH v2 0/2] configfs: fix use-after-free races in configfs_symlink() Izaac Chong
2026-11-14 5:29 ` [PATCH v2 1/2] configfs: fix use-after-free of default group " Izaac Chong
2026-11-14 5:57 ` sashiko-bot [this message]
2026-11-14 5:29 ` [PATCH v2 2/2] configfs: pin symlink target against rmdir before ->allow_link() Izaac Chong
2026-11-14 5:59 ` sashiko-bot
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-214194@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=izaacchong934@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@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