CVE-2026-46194: f2fs: fix node_cnt race between extent node destroy and writeback
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix node_cnt race between extent node destroy and writeback
f2fs_destroy_extent_node() does not set FI_NO_EXTENT before clearing extent nodes. When called from f2fs_drop_inode() with I_SYNC set, concurrent kworker writeback can insert new extent nodes into the same extent tree, racing with the destroy and triggering f2fs_bug_on() in __destroy_extent_node(). The scenario is as follows:
drop inode writeback
- iput
- f2fs_drop_inode // I_SYNC set
- f2fs_destroy_extent_node
- __destroy_extent_node
- while (node_cnt) {
write_lock(&et->lock)
__free_extent_tree
write_unlock(&et->lock)
- __writeback_single_inode
- f2fs_outplace_write_data
- f2fs_update_read_extent_cache
- __update_extent_tree_range // FI_NO_EXTENT not set, // insert new extent node
} // node_cnt == 0, exit while
- f2fs_bug_on(node_cnt) // node_cnt > 0
Additionally, __update_extent_tree_range() only checks FI_NO_EXTENT for EX_READ type, leaving EX_BLOCK_AGE updates completely unprotected.
This patch set FI_NO_EXTENT under et->lock in __destroy_extent_node(), consistent with other callers (__update_extent_tree_range and __drop_extent_tree) and check FI_NO_EXTENT for both EX_READ and EX_BLOCK_AGE tree.
The Linux kernel CVE team has assigned CVE-2026-46194 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.6.66 with commit 295b50e95e900da31ff237e46e04525fa799b2cf and fixed in 6.6.140 with commit 42dd1c91f993431d0b399502479d00e6ad1bca71 Issue introduced in 6.12.5 with commit 924f7dd1e832e4e4530d14711db223d2803f7b61 and fixed in 6.12.88 with commit ab1eaf9d5c99042f5b0243bf67a06283a4c0757f Issue introduced in 6.13 with commit 3fc5d5a182f6a1f8bd4dc775feb54c369dd2c343 and fixed in 6.18.30 with commit b0e4395870eb3441ddc959f6710b5f6ca61aff26 Issue introduced in 6.13 with commit 3fc5d5a182f6a1f8bd4dc775feb54c369dd2c343 and fixed in 7.0.7 with commit 0559a0e962aacbb47519e26ee663be04b72dcb92 Issue introduced in 6.13 with commit 3fc5d5a182f6a1f8bd4dc775feb54c369dd2c343 and fixed in 7.1-rc1 with commit ed78aeebef05212ef7dca93bd931e4eff67c113f
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-46194
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/f2fs/extent_cache.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/42dd1c91f993431d0b399502479d00e6ad1bca71 https://git.kernel.org/stable/c/ab1eaf9d5c99042f5b0243bf67a06283a4c0757f https://git.kernel.org/stable/c/b0e4395870eb3441ddc959f6710b5f6ca61aff26 https://git.kernel.org/stable/c/0559a0e962aacbb47519e26ee663be04b72dcb92 https://git.kernel.org/stable/c/ed78aeebef05212ef7dca93bd931e4eff67c113f