# CVE-2026-31597: ocfs2: fix use-after-free in ocfs2_fault() when VM_FAULT_RETRY

- Severity: High 7.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.13%, higher than 3% of CVEs (2026-12-01)
- Published: 2026-04-24T14:42:22.655Z
- Modified: 2026-11-11T23:10:00.263Z
- Weaknesses: CWE-416
- Assigned by: Linux

## Description

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

ocfs2: fix use-after-free in ocfs2_fault() when VM_FAULT_RETRY

filemap_fault() may drop the mmap_lock before returning VM_FAULT_RETRY,
as documented in mm/filemap.c:

  "If our return value has VM_FAULT_RETRY set, it's because the mmap_lock
  may be dropped before doing I/O or by lock_folio_maybe_drop_mmap()."

When this happens, a concurrent munmap() can call remove_vma() and free
the vm_area_struct via RCU. The saved 'vma' pointer in ocfs2_fault() then
becomes a dangling pointer, and the subsequent trace_ocfs2_fault() call
dereferences it -- a use-after-free.

Fix this by saving ip_blkno as a plain integer before calling
filemap_fault(), and removing vma from the trace event. Since
ip_blkno is copied by value before the lock can be dropped, it
remains valid regardless of what happens to the vma or inode
afterward.

(As written by CVE List.)

## Affected

- Linux Linux: from 614a9e849ca6ea24843795251cb30af525d5336b before 36539c4d536f851a3b346a6ebb27b51bc3d77a94; from 614a9e849ca6ea24843795251cb30af525d5336b before 35c2c05261d6f6d84aaa1355afa201d507943e76; from 614a9e849ca6ea24843795251cb30af525d5336b before 3f5e74b5db9353b01ed50f4de84e75b755f8fbc2; from 614a9e849ca6ea24843795251cb30af525d5336b before 6f072daefcab1d84ce37c073645615f63be91006; from 614a9e849ca6ea24843795251cb30af525d5336b before 4cf2768a0291a0cdd0dae801ea0eafa3878a349d; from 614a9e849ca6ea24843795251cb30af525d5336b before d45ff441b416d4aa1af72b1db23d959601c04da2; from 614a9e849ca6ea24843795251cb30af525d5336b before 76a602fdbb78dd05b2da06f74a988cebc97e82d0; from 614a9e849ca6ea24843795251cb30af525d5336b before 925bf22c1b823e231b1baea761fe8a1512e442f2; from 614a9e849ca6ea24843795251cb30af525d5336b before 7de554cabf160e331e4442e2a9ad874ca9875921; 2.6.39 (not affected: before 2.6.39; from 5.10.258 up to 5.10.*; from 5.15.209 up to 5.15.*; from 6.1.175 up to 6.1.*; from 6.6.136 up to 6.6.*; from 6.12.83 up to 6.12.*; from 6.18.24 up to 6.18.*; from 6.19.14 up to 6.19.*; from 7.0.1 up to 7.0.*; from 7.1 up to *)
- linux linux_kernel: from 2.6.39 before 6.6.136; from 6.7 before 6.12.83; from 6.13 before 6.18.24; from 6.19 before 6.19.14; from 7.0 before 7.0.1

## References

- <https://git.kernel.org/stable/c/36539c4d536f851a3b346a6ebb27b51bc3d77a94>
- <https://git.kernel.org/stable/c/35c2c05261d6f6d84aaa1355afa201d507943e76>
- <https://git.kernel.org/stable/c/3f5e74b5db9353b01ed50f4de84e75b755f8fbc2>
- <https://git.kernel.org/stable/c/6f072daefcab1d84ce37c073645615f63be91006> (patch)
- <https://git.kernel.org/stable/c/4cf2768a0291a0cdd0dae801ea0eafa3878a349d> (patch)
- <https://git.kernel.org/stable/c/d45ff441b416d4aa1af72b1db23d959601c04da2> (patch)
- <https://git.kernel.org/stable/c/76a602fdbb78dd05b2da06f74a988cebc97e82d0> (patch)
- <https://git.kernel.org/stable/c/925bf22c1b823e231b1baea761fe8a1512e442f2> (patch)
- <https://git.kernel.org/stable/c/7de554cabf160e331e4442e2a9ad874ca9875921> (patch)

## Sources

- CVE List: [CVE-2026-31597](https://www.cve.org/CVERecord?id=CVE-2026-31597), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2026-31597](https://nvd.nist.gov/vuln/detail/CVE-2026-31597), Public domain, modified 2026-11-11

---

Page: https://cve.day/CVE-2026-31597 · Whole record: https://cve.day/CVE-2026-31597.json · Rebuilt by cve.day 2026-11-25T22:59:19.504Z
