Skip to contentSkip to conversation

CVE-2026-98245: btrfs: take commit root semaphore when iterating in mark_block_group_to_copy()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 6

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

btrfs: take commit root semaphore when iterating in mark_block_group_to_copy()

mark_block_group_to_copy() iterates over the commit root with skip_locking=true. A concurrent transaction commit can swap and free the commit root during iteration, causing use-after-free when accessing extent buffers.

Fix it by using path->need_commit_sem to protect the commit root search.

The Linux kernel CVE team has assigned CVE-2026-98245 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.12 with commit 78ce9fc269af6e69c1399ab910ba6bc81c934f67 and fixed in 6.12.112 with commit 8e2007b263ea250251ec3021a0a197da990ee1a8
	Issue introduced in 5.12 with commit 78ce9fc269af6e69c1399ab910ba6bc81c934f67 and fixed in 6.18.54 with commit 709f6a5e986535005110c6c69b322f63631cb200
	Issue introduced in 5.12 with commit 78ce9fc269af6e69c1399ab910ba6bc81c934f67 and fixed in 7.2.8 with commit c32490c6d3f3a9f2d177d57c7eb8bbc347561d08
	Issue introduced in 5.12 with commit 78ce9fc269af6e69c1399ab910ba6bc81c934f67 and fixed in 7.3-rc4 with commit 0594e3423f4ba3137c734371169491f9a98e9af4

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-98245

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
fs/btrfs/dev-replace.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/8e2007b263ea250251ec3021a0a197da990ee1a8
	https://git.kernel.org/stable/c/709f6a5e986535005110c6c69b322f63631cb200
	https://git.kernel.org/stable/c/c32490c6d3f3a9f2d177d57c7eb8bbc347561d08
	https://git.kernel.org/stable/c/0594e3423f4ba3137c734371169491f9a98e9af4