# CVE-2026-139799: mm/shmem: hold off eviction in shmem\_writeout()

- **Severity:** HIGH 7.0
- **CVSS:** 7.0 (v3.1, CNA) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; 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)
- **Published:** 2026-11-30T13:38:06.394Z
- **Modified:** 2026-12-01T06:17:49.973Z

## Who should check

- Anyone running Linux \>= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, \< d64fd1229fb1437d7c62c49eba82691bfd65d541; \>= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, \< f53ee5a65460010cabd75895d83258d90923ca7a; \>= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, \< 8f59173b5ca358bf4d1017b44da3cbe6faa80daf
- Anyone running Linux 6.17

## Description

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

mm/shmem: hold off eviction in shmem\_writeout()

Once shmem\_writeout() has moved the folio from the page cache to the
swap cache, the folio lock no longer keeps the inode alive: truncation
and eviction find a swap entry, free it and do not wait for anybody.
That did not matter as long as swap\_writeout() was the last thing the
function did.  But since it puts the folio back when swap\_writeout()
returns AOP\_WRITEPAGE\_ACTIVATE, it uses the mapping and the inode
afterwards:

  reclaim                               last close of an unlinked file
  shmem\_writeout()
    shmem\_delete\_from\_page\_cache()
    swap\_writeout()
      zswap\_store() fails               shmem\_evict\_inode()
      writeback is disabled               shmem\_truncate\_range()
      return AOP\_WRITEPAGE\_ACTIVATE         shmem\_free\_swap()
                                        destroy\_inode()
                                        ... RCU grace period, freed
    shmem\_add\_to\_page\_cache(mapping)
      xas\_lock\_irq()            \<- use after free

swap\_writeout() behaves that way if zswap is enabled, cannot take the
folio and the memcg or one of its ancestors has memory.zswap.writeback
set to 0.

shmem\_unuse() already added infrastructure to deal with that.
Reuse info-\>stop\_eviction to protect the inode during writeout. Increment
it before removing the folio from the page cache, and decrement it after
swap\_writeout() and any attempted reinsertion and inode accounting.
In shmem\_evict\_inode(), wait for the counter to reach zero even if
swapoff has already removed the inode from the swap list. Add some helpers
to make the code easier to digest.

There is a known remaining issue with two swapoffs racing, and the empty
list check not being able to detect that race. That will be addressed
separately later.

Fix generated by an LLM and sent by Josef Bacik in private.

\[ david: code cleanups; improve description \]

## Affected and fixed versions

- Linux: \>= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, \< d64fd1229fb1437d7c62c49eba82691bfd65d541; \>= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, \< f53ee5a65460010cabd75895d83258d90923ca7a; \>= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, \< 8f59173b5ca358bf4d1017b44da3cbe6faa80daf (cvelist)
- Linux: 6.17 (cvelist)

## Technologies

Linux kernel

## Mitigation

- Upgrade Linux to 8f59173b5ca358bf4d1017b44da3cbe6faa80daf or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2026-139799.md
Affected: Linux >= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, < d64fd1229fb1437d7c62c49eba82691bfd65d541; >= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, < f53ee5a65460010cabd75895d83258d90923ca7a; >= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, < 8f59173b5ca358bf4d1017b44da3cbe6faa80daf; Linux 6.17
Fixed in: Linux 8f59173b5ca358bf4d1017b44da3cbe6faa80daf

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-2026-139799 being exploited?

There is no confirmed exploitation: CVE-2026-139799 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known.

### How serious is CVE-2026-139799?

High: CVSS 7.0 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2026-139799?

Linux \>= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, \< d64fd1229fb1437d7c62c49eba82691bfd65d541; \>= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, \< f53ee5a65460010cabd75895d83258d90923ca7a; \>= 6344a6d9ce13ae29e3ddf280fd8a1109a77b9996, \< 8f59173b5ca358bf4d1017b44da3cbe6faa80daf; Linux 6.17.

### Is there a fix for CVE-2026-139799?

Yes. Fixed in Linux 8f59173b5ca358bf4d1017b44da3cbe6faa80daf. Upgrade Linux to 8f59173b5ca358bf4d1017b44da3cbe6faa80daf or later.

### How do I check if I'm affected by CVE-2026-139799?

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

- other: <https://git.kernel.org/stable/c/d64fd1229fb1437d7c62c49eba82691bfd65d541>
- other: <https://git.kernel.org/stable/c/f53ee5a65460010cabd75895d83258d90923ca7a>
- other: <https://git.kernel.org/stable/c/8f59173b5ca358bf4d1017b44da3cbe6faa80daf>

## 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-2026-139799>

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