# CVE-2025-39879: ceph: always call ceph\_shift\_unused\_folios\_left()

> 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, CNA) `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.23% (percentile 8, 2026-11-26)
- **CWE:** CWE-476
- **Published:** 2025-09-23T06:00:49.377Z
- **Modified:** 2026-10-21T13:18:16.270Z

## Who should check

- Anyone running Linux \>= 0f2b2b7cacf888229cec19126e6791b11fb35f32, \< 523214f0afa1b3d0e696917bc5a4d0737718e3d7; \>= ce80b76dd32764cc914975777e058d4fae4f0ea0, \< 289b6615cf553d98509a9b273195d9936da1cfb2; \>= ce80b76dd32764cc914975777e058d4fae4f0ea0, \< cce7c15faaac79b532a07ed6ab8332280ad83762
- Anyone running Linux 6.15

## Description

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

ceph: always call ceph\_shift\_unused\_folios\_left()

The function ceph\_process\_folio\_batch() sets folio\_batch entries to
NULL, which is an illegal state.  Before folio\_batch\_release() crashes
due to this API violation, the function ceph\_shift\_unused\_folios\_left()
is supposed to remove those NULLs from the array.

However, since commit ce80b76dd327 ("ceph: introduce
ceph\_process\_folio\_batch() method"), this shifting doesn't happen
anymore because the "for" loop got moved to ceph\_process\_folio\_batch(),
and now the \`i\` variable that remains in ceph\_writepages\_start()
doesn't get incremented anymore, making the shifting effectively
unreachable much of the time.

Later, commit 1551ec61dc55 ("ceph: introduce ceph\_submit\_write()
method") added more preconditions for doing the shift, replacing the
\`i\` check (with something that is still just as broken):

- if ceph\_process\_folio\_batch() fails, shifting never happens

- if ceph\_move\_dirty\_page\_in\_page\_array() was never called (because
  ceph\_process\_folio\_batch() has returned early for some of various
  reasons), shifting never happens

- if \`processed\_in\_fbatch\` is zero (because ceph\_process\_folio\_batch()
  has returned early for some of the reasons mentioned above or
  because ceph\_move\_dirty\_page\_in\_page\_array() has failed), shifting
  never happens

Since those two commits, any problem in ceph\_process\_folio\_batch()
could crash the kernel, e.g. this way:

 BUG: kernel NULL pointer dereference, address: 0000000000000034
 \#PF: supervisor write access in kernel mode
 \#PF: error\_code(0x0002) - not-present page
 PGD 0 P4D 0
 Oops: Oops: 0002 \[\#1\] SMP NOPTI
 CPU: 172 UID: 0 PID: 2342707 Comm: kworker/u778:8 Not tainted 6.15.10-cm4all1-es \#714 NONE
 Hardware name: Dell Inc. PowerEdge R7615/0G9DHV, BIOS 1.6.10 12/08/2023
 Workqueue: writeback wb\_workfn (flush-ceph-1)
 RIP: 0010:folios\_put\_refs+0x85/0x140
 Code: 83 c5 01 39 e8 7e 76 48 63 c5 49 8b 5c c4 08 b8 01 00 00 00 4d 85 ed 74 05 41 8b 44 ad 00 48 8b 15 b0 \>
 RSP: 0018:ffffb880af8db778 EFLAGS: 00010207
 RAX: 0000000000000001 RBX: 0000000000000000 RCX: 0000000000000003
 RDX: ffffe377cc3b0000 RSI: 0000000000000000 RDI: ffffb880af8db8c0
 RBP: 0000000000000000 R08: 000000000000007d R09: 000000000102b86f
 R10: 0000000000000001 R11: 00000000000000ac R12: ffffb880af8db8c0
 R13: 0000000000000000 R14: 0000000000000000 R15: ffff9bd262c97000
 FS:  0000000000000000(0000) GS:ffff9c8efc303000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000034 CR3: 0000000160958004 CR4: 0000000000770ef0
 PKRU: 55555554
 Call Trace:
  \<TASK\>
  ceph\_writepages\_start+0xeb9/0x1410

The crash can be reproduced easily by changing the
ceph\_check\_page\_before\_write() return value to \`-E2BIG\`.

(Interestingly, the crash happens only if \`huge\_zero\_folio\` has
already been allocated; without \`huge\_zero\_folio\`,
is\_huge\_zero\_folio(NULL) returns true and folios\_put\_refs() skips NULL
entries instead of dereferencing them.  That makes reproducing the bug
somewhat unreliable.  See
https://lore.kernel.org/20250826231626.218675-1-max.kellermann@ionos.com
for a discussion of this detail.)

My suggestion is to move the ceph\_shift\_unused\_folios\_left() to right
after ceph\_process\_folio\_batch() to ensure it always gets called to
fix up the illegal folio\_batch state.

## Affected and fixed versions

- Linux: \>= 0f2b2b7cacf888229cec19126e6791b11fb35f32, \< 523214f0afa1b3d0e696917bc5a4d0737718e3d7; \>= ce80b76dd32764cc914975777e058d4fae4f0ea0, \< 289b6615cf553d98509a9b273195d9936da1cfb2; \>= ce80b76dd32764cc914975777e058d4fae4f0ea0, \< cce7c15faaac79b532a07ed6ab8332280ad83762 (cvelist)
- Linux: 6.15 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-39879.md
Affected: Linux >= 0f2b2b7cacf888229cec19126e6791b11fb35f32, < 523214f0afa1b3d0e696917bc5a4d0737718e3d7; >= ce80b76dd32764cc914975777e058d4fae4f0ea0, < 289b6615cf553d98509a9b273195d9936da1cfb2; >= ce80b76dd32764cc914975777e058d4fae4f0ea0, < cce7c15faaac79b532a07ed6ab8332280ad83762; Linux 6.15
Fixed in: Linux 523214f0afa1b3d0e696917bc5a4d0737718e3d7, Linux 289b6615cf553d98509a9b273195d9936da1cfb2

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

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

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

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

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

Linux \>= 0f2b2b7cacf888229cec19126e6791b11fb35f32, \< 523214f0afa1b3d0e696917bc5a4d0737718e3d7; \>= ce80b76dd32764cc914975777e058d4fae4f0ea0, \< 289b6615cf553d98509a9b273195d9936da1cfb2; \>= ce80b76dd32764cc914975777e058d4fae4f0ea0, \< cce7c15faaac79b532a07ed6ab8332280ad83762; Linux 6.15.

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

Yes. Fixed in Linux 523214f0afa1b3d0e696917bc5a4d0737718e3d7, Linux 289b6615cf553d98509a9b273195d9936da1cfb2. No fix listed yet: follow the vendor advisory.

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

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/289b6615cf553d98509a9b273195d9936da1cfb2>
- patch: <https://git.kernel.org/stable/c/cce7c15faaac79b532a07ed6ab8332280ad83762>
- other: <https://git.kernel.org/stable/c/523214f0afa1b3d0e696917bc5a4d0737718e3d7>

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

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