CVE-2025-39727 mm: swap: fix potential buffer overflow in setup_clusters()

High 7.8 Published Updated

A buffer overflow in the Linux kernel's swap subsystem allows attackers to potentially execute arbitrary code or escalate privileges.

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-2025-39727?

CVE-2025-39727 is a high-severity memory corruption vulnerability in Linux kernel, published on 7 Sep 2025. 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:

mm: swap: fix potential buffer overflow in setup_clusters()

In setup_swap_map(), we only ensure badpages are in range (0, last_page]. As maxpages might be < last_page, setup_clusters() will encounter a buffer overflow when a badpage is >= maxpages.

Only call inc_cluster_info_page() for badpage which is < maxpages to fix the issue.

Weakness: CWE-120

Which versions are affected by CVE-2025-39727?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2025-39727?

Apply the vendor's patch.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2025-39727 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2025-39727, DEBIAN-CVE-2025-39727, GHSA-x952-wmpf-82wc, UBUNTU-CVE-2025-39727.

Is CVE-2025-39727 in your software?

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

Check your SBOMs for free