# CVE-2025-22127: f2fs: fix potential deadloop in prepare\_compress\_overwrite()

> 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.21% (percentile 7, 2026-11-26)
- **CWE:** CWE-667
- **Published:** 2025-04-16T14:13:10.015Z
- **Modified:** 2026-10-30T13:17:57.243Z

## Who should check

- Anyone running Linux \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 353b262268c1646a0e7c96d4ed14c5d72a30ccb4; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 4513843d58d8fa1daebd3817205a15309b146342; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 7cd460bd9e7c6e6c30a33982603f65fb5deab1e4; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 7215cf8ef54bdc9082dffac4662416d54961e258; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 3147ee567dd9004a49826ddeaf0a4b12865d4409
- Anyone running Linux 5.6

## Description

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

f2fs: fix potential deadloop in prepare\_compress\_overwrite()

Jan Prusakowski reported a kernel hang issue as below:

When running xfstests on linux-next kernel (6.14.0-rc3, 6.12) I
encountered a problem in generic/475 test where fsstress process
gets blocked in \_\_f2fs\_write\_data\_pages() and the test hangs.
The options I used are:

MKFS\_OPTIONS  -- -O compression -O extra\_attr -O project\_quota -O quota /dev/vdc
MOUNT\_OPTIONS -- -o acl,user\_xattr -o discard,compress\_extension=\* /dev/vdc /vdc

INFO: task kworker/u8:0:11 blocked for more than 122 seconds.
      Not tainted 6.14.0-rc3-xfstests-lockdep \#1
"echo 0 \> /proc/sys/kernel/hung\_task\_timeout\_secs" disables this message.
task:kworker/u8:0    state:D stack:0     pid:11    tgid:11    ppid:2      task\_flags:0x4208160 flags:0x00004000
Workqueue: writeback wb\_workfn (flush-253:0)
Call Trace:
 \<TASK\>
 \_\_schedule+0x309/0x8e0
 schedule+0x3a/0x100
 schedule\_preempt\_disabled+0x15/0x30
 \_\_mutex\_lock+0x59a/0xdb0
 \_\_f2fs\_write\_data\_pages+0x3ac/0x400
 do\_writepages+0xe8/0x290
 \_\_writeback\_single\_inode+0x5c/0x360
 writeback\_sb\_inodes+0x22f/0x570
 wb\_writeback+0xb0/0x410
 wb\_do\_writeback+0x47/0x2f0
 wb\_workfn+0x5a/0x1c0
 process\_one\_work+0x223/0x5b0
 worker\_thread+0x1d5/0x3c0
 kthread+0xfd/0x230
 ret\_from\_fork+0x31/0x50
 ret\_from\_fork\_asm+0x1a/0x30
 \</TASK\>

The root cause is: once generic/475 starts toload error table to dm
device, f2fs\_prepare\_compress\_overwrite() will loop reading compressed
cluster pages due to IO error, meanwhile it has held .writepages lock,
it can block all other writeback tasks.

Let's fix this issue w/ below changes:
- add f2fs\_handle\_page\_eio() in prepare\_compress\_overwrite() to
detect IO error.
- detect cp\_error earler in f2fs\_read\_multi\_pages().

## Affected and fixed versions

- Linux: \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 353b262268c1646a0e7c96d4ed14c5d72a30ccb4; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 4513843d58d8fa1daebd3817205a15309b146342; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 7cd460bd9e7c6e6c30a33982603f65fb5deab1e4; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 7215cf8ef54bdc9082dffac4662416d54961e258; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 3147ee567dd9004a49826ddeaf0a4b12865d4409 (cvelist)
- Linux: 5.6 (cvelist)

## Mitigation

- Upgrade Linux to 3147ee567dd9004a49826ddeaf0a4b12865d4409 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-22127. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-22127.md
Affected: Linux >= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, < 353b262268c1646a0e7c96d4ed14c5d72a30ccb4; >= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, < 4513843d58d8fa1daebd3817205a15309b146342; >= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, < 7cd460bd9e7c6e6c30a33982603f65fb5deab1e4; >= 4c8ff7095bef64fc47e996a…
Fixed in: Linux 353b262268c1646a0e7c96d4ed14c5d72a30ccb4, Linux 4513843d58d8fa1daebd3817205a15309b146342, Linux 7cd460bd9e7c6e6c30a33982603f65fb5deab1e4, Linux 7215cf8ef54bdc9082dffac4662416d54961e258, Linux 3147ee567dd9004a49826ddeaf0a4b12865d4409

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-22127 being exploited?

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

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

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

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

Linux \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 353b262268c1646a0e7c96d4ed14c5d72a30ccb4; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 4513843d58d8fa1daebd3817205a15309b146342; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 7cd460bd9e7c6e6c30a33982603f65fb5deab1e4; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 7215cf8ef54bdc9082dffac4662416d54961e258; \>= 4c8ff7095bef64fc47e996a938f7d57f9e077da3, \< 3147ee567dd9004a49826ddeaf0a4b12865d4409; Linux 5.6.

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

Yes. Fixed in Linux 353b262268c1646a0e7c96d4ed14c5d72a30ccb4, Linux 4513843d58d8fa1daebd3817205a15309b146342, Linux 7cd460bd9e7c6e6c30a33982603f65fb5deab1e4, Linux 7215cf8ef54bdc9082dffac4662416d54961e258, Linux 3147ee567dd9004a49826ddeaf0a4b12865d4409. Upgrade Linux to 3147ee567dd9004a49826ddeaf0a4b12865d4409 or later.

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

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/7215cf8ef54bdc9082dffac4662416d54961e258>
- patch: <https://git.kernel.org/stable/c/3147ee567dd9004a49826ddeaf0a4b12865d4409>
- other: <https://git.kernel.org/stable/c/353b262268c1646a0e7c96d4ed14c5d72a30ccb4>
- other: <https://git.kernel.org/stable/c/4513843d58d8fa1daebd3817205a15309b146342>
- other: <https://git.kernel.org/stable/c/7cd460bd9e7c6e6c30a33982603f65fb5deab1e4>

## 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-22127>

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