# CVE-2025-21860: mm/zswap: fix inconsistency when zswap\_store\_page() fails

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

- **Severity:** LOW 3.3
- **CVSS:** 3.3 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: Low
- **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.25% (percentile 10, 2026-11-26)
- **Published:** 2025-03-12T09:42:18.521Z
- **Modified:** 2026-06-17T08:44:28.123Z

## Who should check

- Anyone running Linux \>= b7c0ccdfbafdec98699ddb6f164beebf16f0bc45, \< a3652f5552b20903315612da487a7be2b95394d5; \>= b7c0ccdfbafdec98699ddb6f164beebf16f0bc45, \< 63895d20d63b446f5049a963983489319c2ea3e2
- Anyone running Linux 6.13

## Description

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

mm/zswap: fix inconsistency when zswap\_store\_page() fails

Commit b7c0ccdfbafd ("mm: zswap: support large folios in zswap\_store()")
skips charging any zswap entries when it failed to zswap the entire folio.

However, when some base pages are zswapped but it failed to zswap the
entire folio, the zswap operation is rolled back.  When freeing zswap
entries for those pages, zswap\_entry\_free() uncharges the zswap entries
that were not previously charged, causing zswap charging to become
inconsistent.

This inconsistency triggers two warnings with following steps:
  \# On a machine with 64GiB of RAM and 36GiB of zswap
  $ stress-ng --bigheap 2 \# wait until the OOM-killer kills stress-ng
  $ sudo reboot

  The two warnings are:
    in mm/memcontrol.c:163, function obj\_cgroup\_release():
      WARN\_ON\_ONCE(nr\_bytes & (PAGE\_SIZE - 1));

    in mm/page\_counter.c:60, function page\_counter\_cancel():
      if (WARN\_ONCE(new \< 0, "page\_counter underflow: %ld nr\_pages=%lu\\n",
	  new, nr\_pages))

zswap\_stored\_pages also becomes inconsistent in the same way.

As suggested by Kanchana, increment zswap\_stored\_pages and charge zswap
entries within zswap\_store\_page() when it succeeds.  This way,
zswap\_entry\_free() will decrement the counter and uncharge the entries
when it failed to zswap the entire folio.

While this could potentially be optimized by batching objcg charging and
incrementing the counter, let's focus on fixing the bug this time and
leave the optimization for later after some evaluation.

After resolving the inconsistency, the warnings disappear.

\[42.hyeyoo@gmail.com: refactor zswap\_store\_page()\]

## Affected and fixed versions

- Linux: \>= b7c0ccdfbafdec98699ddb6f164beebf16f0bc45, \< a3652f5552b20903315612da487a7be2b95394d5; \>= b7c0ccdfbafdec98699ddb6f164beebf16f0bc45, \< 63895d20d63b446f5049a963983489319c2ea3e2 (cvelist)
- Linux: 6.13 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2025-21860.md
Affected: Linux >= b7c0ccdfbafdec98699ddb6f164beebf16f0bc45, < a3652f5552b20903315612da487a7be2b95394d5; >= b7c0ccdfbafdec98699ddb6f164beebf16f0bc45, < 63895d20d63b446f5049a963983489319c2ea3e2; Linux 6.13
Fixed in: Linux 63895d20d63b446f5049a963983489319c2ea3e2

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

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

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

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

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

Linux \>= b7c0ccdfbafdec98699ddb6f164beebf16f0bc45, \< a3652f5552b20903315612da487a7be2b95394d5; \>= b7c0ccdfbafdec98699ddb6f164beebf16f0bc45, \< 63895d20d63b446f5049a963983489319c2ea3e2; Linux 6.13.

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

Yes. Fixed in Linux 63895d20d63b446f5049a963983489319c2ea3e2. Upgrade Linux to 63895d20d63b446f5049a963983489319c2ea3e2 or later.

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

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/a3652f5552b20903315612da487a7be2b95394d5>
- patch: <https://git.kernel.org/stable/c/63895d20d63b446f5049a963983489319c2ea3e2>

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

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