From: Breno Leitao <leitao@debian.org>
To: Vasileios Almpanis <vasilisalmpanis@gmail.com>
Cc: Andreas Hindborg <a.hindborg@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
syzbot+6b16e3d085833cbf3e25@syzkaller.appspotmail.com
Subject: Re: [PATCH 0/2] configfs: fix use-after-free of symlink target racing with rmdir
Date: Wed, 26 Aug 2026 02:16:51 -0700 [thread overview]
Message-ID: <ao6u5LxY6kp-wbtb@gmail.com> (raw)
In-Reply-To: <20260730093435.195441-1-vasilisalmpanis@gmail.com>
On Thu, Jul 30, 2026 at 11:30:23AM +0200, Vasileios Almpanis wrote:
> syzkaller reported a slab-use-after-free in config_item_get() when
> symlink(2) races with rmdir(2) of the symlink target:
>
> BUG: KASAN: slab-use-after-free in config_item_get+0x26/0x90
> configfs_get_config_item fs/configfs/configfs_internal.h:127 [inline]
> get_target fs/configfs/symlink.c:128 [inline]
> configfs_symlink+0x4ab/0x1030 fs/configfs/symlink.c:185
>
> configfs_symlink() resolves the target with no locks, with the idea
> that a hashed dentry means a live config_item. configfs_rmdir() drops
> the last reference to the item before the dentry gets unhashed by
> d_delete() in vfs_rmdir(), so get_target() could take a reference on
> an already freed item.
>
> Patch 2 fixes this by unhashing the dentry in configfs_remove_dir(),
> before the item can be freed. Patch 1 fixes a second lifetime bug in
> the same path that the earlier unhashing makes easy to hit: an item
> reference does not pin the item's dentry, so create_link() must not
> reach the target's configfs_dirent through ->ci_dentry. The patches
> must be applied in this order.
>
> Tested with the syzkaller reproducer, which no longer triggers either
> the KASAN report or the s_count warning.
>
> Vasileios Almpanis (2):
> configfs: pin the symlink target's dirent instead of chasing
> ->ci_dentry
> configfs: unhash the dentry before dropping the item in rmdir
Tested-by: Breno Leitao <leitao@debian.org>
Reviwed-by: Breno Leitao <leitao@debian.org>
next prev parent reply other threads:[~2026-08-26 9:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 9:30 [PATCH 0/2] configfs: fix use-after-free of symlink target racing with rmdir Vasileios Almpanis
2026-07-30 9:30 ` [PATCH 1/2] configfs: pin the symlink target's dirent instead of chasing ->ci_dentry Vasileios Almpanis
2026-07-30 9:30 ` [PATCH 2/2] configfs: unhash the dentry before dropping the item in rmdir Vasileios Almpanis
2026-07-31 9:29 ` Breno Leitao
2026-07-31 9:55 ` Vasileios Almpanis
2026-08-12 7:00 ` [PATCH 0/2] configfs: fix use-after-free of symlink target racing with rmdir Vasileios Almpanis
2026-08-26 9:17 ` Breno Leitao
2026-08-26 9:16 ` Breno Leitao [this message]
2026-08-26 9:38 ` Breno Leitao
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=ao6u5LxY6kp-wbtb@gmail.com \
--to=leitao@debian.org \
--cc=a.hindborg@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+6b16e3d085833cbf3e25@syzkaller.appspotmail.com \
--cc=vasilisalmpanis@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/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