CVE-2025-38164
Medium · 5.5CVSS
5.5
EPSS
0.2%
Published
Jul 3, 2025
CISA due date
—
Cloudanix analysis
A bug in the Linux filesystem code can cause the drive to shut itself down when certain file operations are performed, potentially taking services offline until fixed.
- Exploitation
- Local Privilege
- Attacker needs
- Low Privilege
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- OS kernel
- Class
- Improper Input Validation
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The flaw allows f2fs_gc_range() to attempt block migration on an opened section whose SSA summary data remains cached in curseg, producing SIT/SSA type inconsistency that triggers f2fs_handle_critical_error and stops the filesystem.
Why it matters to the business
Systems using f2fs on zoned block devices can experience sudden, unrecoverable filesystem shutdown during ordinary file allocation operations, resulting in service outages and potential data inaccessibility until the volume is repaired or replaced.
How an attack unfolds
A local user creates a pinned file on an f2fs zoned mount, performs a large fallocate, and causes the garbage collector to select a section still referenced by cached curseg summaries, hitting the inconsistency check and halting the filesystem.
How to fix it
Update to a kernel containing commit 44a51592ac657d8e422585414d7ec17a5b50fb0e or later; rebuild and reboot all affected hosts. Until patches are applied, avoid f2fs on zoned devices or disable pinning/fallocate workloads that trigger garbage collection on open sections.
How to confirm the fix worked
Confirm the running kernel contains commit 44a51592ac657d8e422585414d7ec17a5b50fb0e via git describe or kernel version string; reproduce the original test case and verify that f2fs_handle_critical_error is no longer reached.
Typical attack path
- Mount f2fs on a zoned null_blk or equivalent device with -m flag
- Create a file and mark it pinned via f2fs_io
- Issue fallocate requesting several GiB of space
- f2fs_allocate_pinning_section invokes f2fs_gc_range on an opened section
- SSA block for that section is not yet on media, producing type mismatch
- Kernel logs critical error and stops the filesystem
How to detect it
Search kernel logs and dmesg for the strings "Inconsistent segment" and "Stopped filesystem due to reason: 4"; correlate with f2fs_gc_range and f2fs_allocate_pinning_section call traces on systems using zoned f2fs mounts.
- F2FS-fs.*Inconsistent segment.*type.*in SSA and SIT
- F2FS-fs.*Stopped filesystem due to reason: 4
- f2fs_handle_critical_error.*do_garbage_collect
What your security team should do
- Prioritize patching all production hosts running f2fs on zoned storage within the next maintenance window
- Add kernel version checks to configuration management and CI pipelines
- Restrict untrusted local accounts from performing fallocate on f2fs mounts until patched
- Monitor for the exact error string "Inconsistent segment" in kernel logs
The record
In the Linux kernel, the following vulnerability has been resolved: f2fs: zone: fix to avoid inconsistence in between SIT and SSA w/ below testcase, it will cause inconsistence in between SIT and SSA. create_null_blk 512 2 1024 1024 mkfs.f2fs -m /dev/nullb0 mount /dev/nullb0 /mnt/f2fs/ touch /mnt/f2fs/file f2fs_io pinfile set /mnt/f2fs/file fallocate -l 4GiB /mnt/f2fs/file F2FS-fs (nullb0): Inconsistent segment (0) type [1, 0] in SSA and SIT CPU: 5 UID: 0 PID: 2398 Comm: fallocate Tainted: G O 6.13.0-rc1 #84 Tainted: [O]=OOT_MODULE Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 Call Trace: <TASK> dump_stack_lvl+0xb3/0xd0 dump_stack+0x14/0x20 f2fs_handle_critical_error+0x18c/0x220 [f2fs] f2fs_stop_checkpoint+0x38/0x50 [f2fs] do_garbage_collect+0x674/0x6e0 [f2fs] f2fs_gc_range+0x12b/0x230 [f2fs] f2fs_allocate_pinning_section+0x5c/0x150 [f2fs] f2fs_expand_inode_data+0x1cc/0x3c0 [f2fs] f2fs_fallocate+0x3c3/0x410 [f2fs] vfs_fallocate+0x15f/0x4b0 __x64_sys_fallocate+0x4a/0x80 x64_sys_call+0x15e8/0x1b80 do_syscall_64+0x68/0x130 entry_SYSCALL_64_after_hwframe+0x67/0x6f RIP: 0033:0x7f9dba5197ca F2FS-fs (nullb0): Stopped filesystem due to reason: 4 The reason is f2fs_gc_range() may try to migrate block in curseg, however, its SSA block is not uptodate due to the last summary block data is still in cache of curseg. In this patch, we add a condition in f2fs_gc_range() to check whether section is opened or not, and skip block migration for opened section.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:13 | linux | 0 | No fix |
| Linux | Kernel | 6.9.0 | 6.12.34 |
Related vulnerabilities
- CVE-2025-39885 In the Linux kernel, the following vulnerability has been resolved: ocfs2: fix recursive… Also affects linux
- CVE-2025-39883 In the Linux kernel, the following vulnerability has been resolved: mm/memory-failure… Also affects linux
- CVE-2025-39884 In the Linux kernel, the following vulnerability has been resolved: btrfs: fix subvolume… Also affects linux
- CVE-2025-39886 In the Linux kernel, the following vulnerability has been resolved: bpf: Tell memcg to… Also affects linux
- CVE-2025-39876 In the Linux kernel, the following vulnerability has been resolved: net: fec: Fix… Also affects linux
- CVE-2025-39880 In the Linux kernel, the following vulnerability has been resolved: libceph: fix invalid… Also affects linux
- CVE-2025-39881 In the Linux kernel, the following vulnerability has been resolved: kernfs: Fix UAF in… Also affects linux
- CVE-2025-39882 In the Linux kernel, the following vulnerability has been resolved: drm/mediatek: fix… Also affects linux