From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v5 0/2] btrfs: fix a UAF where btrfs_root::dirty_list is freed but still referred
Date: Sun, 11 Oct 2026 18:51:56 +1030 [thread overview]
Message-ID: <cover.1791706855.git.wqu@suse.com> (raw)
[CHANGELOG]
v5:
- Drop the first patch
As we no longer put the list_del_init() call inside
btrfs_put_root(), the existing code is already safe without the need
for extra spinlock, as the existing callers are already holding a
trans handle, thus won't race with transaction cleanup/committing.
- Also drop the spinlock from the 2nd patch
As we are already safe without that lock.
- Update the commit message of the last commit
As we no long hold trans_lock for every btrfs_root::dirty_list caller.
v4:
- Also cleanup qgroup swapped blocks and dirty_log_pages
Which are only released during switch_commit_roots().
v3:
- Use Yalagada's v2 fix as the final UAF fix
The delayed list_del_init() call inside btrfs_put_root() is not
safe as another racing ioctl can grab the quota root, extending
its lifespan.
v2:
- Add extra patches to address Sashiko's comment
* Make all root->dirty_list users to hold trans_lock
* Release root->dirty_list from cur_trans->switch_commits during
transaction cleanup
The first patch is an existing bug exposed by Sashiko, which also
affects the last UAF fix.
The last one is the final UAF fix for the bug reported by syzbot.
Qu Wenruo (1):
btrfs: prevent use-after-free in btrfs_transaction::switch_commits
Yalagada Pavan Kumar (1):
btrfs: fix use-after-free on quota enable allocation failure
fs/btrfs/disk-io.c | 10 ++++++++++
fs/btrfs/qgroup.c | 7 +++++++
2 files changed, 17 insertions(+)
--
2.56.0
next reply other threads:[~2026-10-11 8:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 8:21 Qu Wenruo [this message]
2026-10-11 8:21 ` [PATCH v5 1/2] btrfs: prevent use-after-free in btrfs_transaction::switch_commits Qu Wenruo
2026-10-12 10:41 ` Filipe Manana
2026-10-12 21:13 ` Qu Wenruo
2026-10-12 22:11 ` Qu Wenruo
2026-10-11 8:21 ` [PATCH v5 2/2] btrfs: fix use-after-free on quota enable allocation failure Qu Wenruo
2026-10-12 10:47 ` Filipe Manana
2026-10-12 15:46 ` Daniel Vacek
2026-10-12 17:19 ` Filipe Manana
2026-10-13 5:32 ` Daniel Vacek
2026-10-12 21:17 ` Qu Wenruo
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=cover.1791706855.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/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