# CVE-2025-22123: f2fs: fix to avoid accessing uninitialized curseg

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.28% (percentile 13, 2026-11-26)
- **CWE:** CWE-908
- **Published:** 2025-04-16T14:13:07.213Z
- **Modified:** 2026-06-17T08:45:11.890Z

## Who should check

- Anyone running Linux \>= 8b10d3653735e117bc1954ade80d75ad7b46b801, \< bf49527089ec1ba894c6e587affabbfb2329f52e; \>= 8b10d3653735e117bc1954ade80d75ad7b46b801, \< 7f90e5d423cd2d4c74b2abb527872f335108637f; \>= 8b10d3653735e117bc1954ade80d75ad7b46b801, \< 986c50f6bca109c6cf362b4e2babcb85aba958f6
- Anyone running Linux 6.9

## Description

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

f2fs: fix to avoid accessing uninitialized curseg

syzbot reports a f2fs bug as below:

F2FS-fs (loop3): Stopped filesystem due to reason: 7
kworker/u8:7: attempt to access beyond end of device
BUG: unable to handle page fault for address: ffffed1604ea3dfa
RIP: 0010:get\_ckpt\_valid\_blocks fs/f2fs/segment.h:361 \[inline\]
RIP: 0010:has\_curseg\_enough\_space fs/f2fs/segment.h:570 \[inline\]
RIP: 0010:\_\_get\_secs\_required fs/f2fs/segment.h:620 \[inline\]
RIP: 0010:has\_not\_enough\_free\_secs fs/f2fs/segment.h:633 \[inline\]
RIP: 0010:has\_enough\_free\_secs+0x575/0x1660 fs/f2fs/segment.h:649
 \<TASK\>
 f2fs\_is\_checkpoint\_ready fs/f2fs/segment.h:671 \[inline\]
 f2fs\_write\_inode+0x425/0x540 fs/f2fs/inode.c:791
 write\_inode fs/fs-writeback.c:1525 \[inline\]
 \_\_writeback\_single\_inode+0x708/0x10d0 fs/fs-writeback.c:1745
 writeback\_sb\_inodes+0x820/0x1360 fs/fs-writeback.c:1976
 wb\_writeback+0x413/0xb80 fs/fs-writeback.c:2156
 wb\_do\_writeback fs/fs-writeback.c:2303 \[inline\]
 wb\_workfn+0x410/0x1080 fs/fs-writeback.c:2343
 process\_one\_work kernel/workqueue.c:3236 \[inline\]
 process\_scheduled\_works+0xa66/0x1840 kernel/workqueue.c:3317
 worker\_thread+0x870/0xd30 kernel/workqueue.c:3398
 kthread+0x7a9/0x920 kernel/kthread.c:464
 ret\_from\_fork+0x4b/0x80 arch/x86/kernel/process.c:148
 ret\_from\_fork\_asm+0x1a/0x30 arch/x86/entry/entry\_64.S:244

Commit 8b10d3653735 ("f2fs: introduce FAULT\_NO\_SEGMENT") allows to trigger
no free segment fault in allocator, then it will update curseg-\>segno to
NULL\_SEGNO, though, CP\_ERROR\_FLAG has been set, f2fs\_write\_inode() missed
to check the flag, and access invalid curseg-\>segno directly in below call
path, then resulting in panic:

- f2fs\_write\_inode
 - f2fs\_is\_checkpoint\_ready
  - has\_enough\_free\_secs
   - has\_not\_enough\_free\_secs
    - \_\_get\_secs\_required
     - has\_curseg\_enough\_space
      - get\_ckpt\_valid\_blocks
      : access invalid curseg-\>segno

To avoid this issue, let's:
- check CP\_ERROR\_FLAG flag in prior to f2fs\_is\_checkpoint\_ready() in
f2fs\_write\_inode().
- in has\_curseg\_enough\_space(), save curseg-\>segno into a temp variable,
and verify its validation before use.

## Affected and fixed versions

- Linux: \>= 8b10d3653735e117bc1954ade80d75ad7b46b801, \< bf49527089ec1ba894c6e587affabbfb2329f52e; \>= 8b10d3653735e117bc1954ade80d75ad7b46b801, \< 7f90e5d423cd2d4c74b2abb527872f335108637f; \>= 8b10d3653735e117bc1954ade80d75ad7b46b801, \< 986c50f6bca109c6cf362b4e2babcb85aba958f6 (cvelist)
- Linux: 6.9 (cvelist)

## Mitigation

- Upgrade Linux to 986c50f6bca109c6cf362b4e2babcb85aba958f6 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-22123. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-22123.md
Affected: Linux >= 8b10d3653735e117bc1954ade80d75ad7b46b801, < bf49527089ec1ba894c6e587affabbfb2329f52e; >= 8b10d3653735e117bc1954ade80d75ad7b46b801, < 7f90e5d423cd2d4c74b2abb527872f335108637f; >= 8b10d3653735e117bc1954ade80d75ad7b46b801, < 986c50f6bca109c6cf362b4e2babcb85aba958f6; Linux 6.9
Fixed in: Linux 7f90e5d423cd2d4c74b2abb527872f335108637f, Linux 986c50f6bca109c6cf362b4e2babcb85aba958f6

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-22123 being exploited?

There is no confirmed exploitation: CVE-2025-22123 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.28% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-22123?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-22123?

Linux \>= 8b10d3653735e117bc1954ade80d75ad7b46b801, \< bf49527089ec1ba894c6e587affabbfb2329f52e; \>= 8b10d3653735e117bc1954ade80d75ad7b46b801, \< 7f90e5d423cd2d4c74b2abb527872f335108637f; \>= 8b10d3653735e117bc1954ade80d75ad7b46b801, \< 986c50f6bca109c6cf362b4e2babcb85aba958f6; Linux 6.9.

### Is there a fix for CVE-2025-22123?

Yes. Fixed in Linux 7f90e5d423cd2d4c74b2abb527872f335108637f, Linux 986c50f6bca109c6cf362b4e2babcb85aba958f6. Upgrade Linux to 986c50f6bca109c6cf362b4e2babcb85aba958f6 or later.

### How do I check if I'm affected by CVE-2025-22123?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/bf49527089ec1ba894c6e587affabbfb2329f52e>
- patch: <https://git.kernel.org/stable/c/7f90e5d423cd2d4c74b2abb527872f335108637f>
- patch: <https://git.kernel.org/stable/c/986c50f6bca109c6cf362b4e2babcb85aba958f6>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-22123>

HTML: <https://flawdb.com/CVE-2025-22123> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-22123>
