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

High 7.8 Published Updated

A use-after-free in the Linux kernel's OCFS2 filesystem allows attackers to potentially execute code or escalate privileges via a race condition during memory mapping.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2026-31597?

CVE-2026-31597 is a high-severity use after free vulnerability in Linux kernel, published on 24 Apr 2026. It can only be exploited from the same machine or local network, with no action from the victim.

Official 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.

Weakness: CWE-416

Which versions are affected by CVE-2026-31597?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2026-31597?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2026-31597 being exploited?

There is no known exploitation of CVE-2026-31597 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-83879, BELL-CVE-2026-31597, DEBIAN-CVE-2026-31597, GHSA-8pwc-q4rq-xxf3, ROOT-OS-DEBIAN-11-CVE-2026-31597, ROOT-OS-DEBIAN-12-CVE-2026-31597 and 3 more.

Is CVE-2026-31597 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free