# CVE-2025-37988: fix a couple of races in MNT\_TREE\_BENEATH handling by do\_move\_mount()

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

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; 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)
- **EPSS:** 0.22% (percentile 7, 2026-11-28)
- **CWE:** CWE-362
- **Published:** 2025-05-20T17:09:20.765Z
- **Modified:** 2026-08-05T11:58:47.074Z

## Who should check

- Anyone running Linux \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< 4f435c1f4c48ff84968e2d9159f6fa41f46cf998; \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< a61afd54826ac24c2c93845c4f441dbc344875b1; \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< d4b21e8cd3d7efa2deb9cff534f0133e84f35086; \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< 0d039eac6e5950f9d1ecc9e410c2fd1feaeab3b6
- Anyone running Linux 6.5

## Description

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

fix a couple of races in MNT\_TREE\_BENEATH handling by do\_move\_mount()

Normally do\_lock\_mount(path, \_) is locking a mountpoint pinned by
\*path and at the time when matching unlock\_mount() unlocks that
location it is still pinned by the same thing.

Unfortunately, for 'beneath' case it's no longer that simple -
the object being locked is not the one \*path points to.  It's the
mountpoint of path-\>mnt.  The thing is, without sufficient locking
-\>mnt\_parent may change under us and none of the locks are held
at that point.  The rules are
	\* mount\_lock stabilizes m-\>mnt\_parent for any mount m.
	\* namespace\_sem stabilizes m-\>mnt\_parent, provided that
m is mounted.
	\* if either of the above holds and refcount of m is positive,
we are guaranteed the same for refcount of m-\>mnt\_parent.

namespace\_sem nests inside inode\_lock(), so do\_lock\_mount() has
to take inode\_lock() before grabbing namespace\_sem.  It does
recheck that path-\>mnt is still mounted in the same place after
getting namespace\_sem, and it does take care to pin the dentry.
It is needed, since otherwise we might end up with racing mount --move
(or umount) happening while we were getting locks; in that case
dentry would no longer be a mountpoint and could've been evicted
on memory pressure along with its inode - not something you want
when grabbing lock on that inode.

However, pinning a dentry is not enough - the matching mount is
also pinned only by the fact that path-\>mnt is mounted on top it
and at that point we are not holding any locks whatsoever, so
the same kind of races could end up with all references to
that mount gone just as we are about to enter inode\_lock().
If that happens, we are left with filesystem being shut down while
we are holding a dentry reference on it; results are not pretty.

What we need to do is grab both dentry and mount at the same time;
that makes inode\_lock() safe \*and\* avoids the problem with fs getting
shut down under us.  After taking namespace\_sem we verify that
path-\>mnt is still mounted (which stabilizes its -\>mnt\_parent) and
check that it's still mounted at the same place.  From that point
on to the matching namespace\_unlock() we are guaranteed that
mount/dentry pair we'd grabbed are also pinned by being the mountpoint
of path-\>mnt, so we can quietly drop both the dentry reference (as
the current code does) and mnt one - it's OK to do under namespace\_sem,
since we are not dropping the final refs.

That solves the problem on do\_lock\_mount() side; unlock\_mount()
also has one, since dentry is guaranteed to stay pinned only until
the namespace\_unlock().  That's easy to fix - just have inode\_unlock()
done earlier, while it's still pinned by mp-\>m\_dentry.

## Affected and fixed versions

- Linux: \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< 4f435c1f4c48ff84968e2d9159f6fa41f46cf998; \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< a61afd54826ac24c2c93845c4f441dbc344875b1; \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< d4b21e8cd3d7efa2deb9cff534f0133e84f35086; \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< 0d039eac6e5950f9d1ecc9e410c2fd1feaeab3b6 (cvelist)
- Linux: 6.5 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2025-37988.md
Affected: Linux >= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, < 4f435c1f4c48ff84968e2d9159f6fa41f46cf998; >= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, < a61afd54826ac24c2c93845c4f441dbc344875b1; >= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, < d4b21e8cd3d7efa2deb9cff534f0133e84f35086; >= 6ac392815628f317fcfdca1…
Fixed in: Linux 4f435c1f4c48ff84968e2d9159f6fa41f46cf998, Linux 0d039eac6e5950f9d1ecc9e410c2fd1feaeab3b6

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

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

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

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

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

Linux \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< 4f435c1f4c48ff84968e2d9159f6fa41f46cf998; \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< a61afd54826ac24c2c93845c4f441dbc344875b1; \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< d4b21e8cd3d7efa2deb9cff534f0133e84f35086; \>= 6ac392815628f317fcfdca1a39df00b9cc4ebc8b, \< 0d039eac6e5950f9d1ecc9e410c2fd1feaeab3b6; Linux 6.5.

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

Yes. Fixed in Linux 4f435c1f4c48ff84968e2d9159f6fa41f46cf998, Linux 0d039eac6e5950f9d1ecc9e410c2fd1feaeab3b6. Upgrade Linux to 0d039eac6e5950f9d1ecc9e410c2fd1feaeab3b6 or later.

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

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/4f435c1f4c48ff84968e2d9159f6fa41f46cf998>
- patch: <https://git.kernel.org/stable/c/a61afd54826ac24c2c93845c4f441dbc344875b1>
- patch: <https://git.kernel.org/stable/c/d4b21e8cd3d7efa2deb9cff534f0133e84f35086>
- patch: <https://git.kernel.org/stable/c/0d039eac6e5950f9d1ecc9e410c2fd1feaeab3b6>

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

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