HIGH
f2fs FGGC Inconsistency
CVE-2026-46175
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
KernelScan AI5.5MEDIUM
01Description
In the Linux kernel, the following vulnerability has been resolved: f2fs: fix fsck inconsistency caused by FGGC of node block During FGGC node block migration, fsck may incorrectly treat the migrated node block as fsync-written data. The reproduction scenario: root@vm:/mnt/f2fs# seq 1 2048 | xargs -n 1 ./test_sync // write inline inode and sync root@vm:/mnt/f2fs# rm -f 1 root@vm:/mnt/f2fs# sync root@vm:/mnt/f2fs# f2fs_io gc_range // move data block in sync mode and not write CP SPO, "fsck --dry-run" find inode has already checkpointed but still with DENT_BIT_SHIFT set The root cause is that GC does not clear the dentry mark and fsync mark during node block migration, leading fsck to misinterpret them as user-issued fsync writes. In BGGC mode, node block migration is handled by f2fs_sync_node_pages(), which guarantees the dentry and fsync marks are cleared before writing. This patch move the set/clear of the fsync|dentry marks into __write_node_folio to make the logic clearer, and ensures the fsync|dentry mark is cleared in FGGC.
02KernelScan AI Analysis
Risk summary
F2FS foreground garbage collection fails to clear the fsync and dentry marks during node block migration. When a subsequent sudden power-off occurs, the stale marks cause fsck to misinterpret migrated node blocks as user-issued fsync writes, leading to filesystem inconsistency detection and potential data corruption during recovery. Any unprivileged local user with write access to the filesystem can trigger the vulnerable FGGC path.
Vulnerability analysis
The root cause is a missing cleanup of dentry and fsync mark bits in the FGGC (Foreground Garbage Collection) node-block migration path. In the BGGC path, f2fs_sync_node_pages() clears these marks before writing, but the FGGC path in f2fs_write_single_node_folio() omits this step. The fix consolidates mark handling into __write_node_folio() so both paths consistently clear the bits. Because FGGC is triggered automatically during writeback under space pressure, an unprivileged local user can reach the buggy code by performing writes to an f2fs volume.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 6.18 | 6.18.30 | 8be551f538dc |
| 7.0 | 7.0.7 | e7c6d30169b0 |
| mainline | 7.1-rc1 | c3e238bd1f56 |