HIGH Introduced in 7.0
vfs Statmount UAF
CVE-2026-98994
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: statmount: read the parent of an unmounted mount under mount_lock statmount_mnt_basic() reads the ids of the parent through m->mnt_parent with namespace_sem held for reading. That's fine for a mount that is in a namespace. Everything above it is pinned by that namespace. STATMOUNT_BY_FD also accepts a file descriptor on a mount that has been unmounted on purpose and that only the file descriptor keeps alive. If that mount stayed attached to its parent when it was unmounted the parent is unmounted as well and nothing pins it for the child. The final mntput() unmounts the children under mount_lock alone and frees the parent afterwards. Concurrently, statmount_mnt_basic() reads m->mnt_parent twice while that can happen and can easily dereference a mount that's already gone. Read the parent of an unmounted mount under mount_lock. The parent can't be put while it is held and both ids come from the same mount. A mounted mount's parent is pinned by the namespace and a mount can't leave its namespace while namespace_sem is held, so the common case takes no global lock.
02KernelScan AI Analysis
Risk summary
A local unprivileged user can trigger a use-after-free in the statmount syscall when querying a detached (unmounted) mount via file descriptor. The race between reading the parent mount ID and the final mntput() freeing that parent allows kernel memory corruption, leading to privilege escalation or denial of service.
Vulnerability analysis
The statmount_mnt_basic() function reads the parent mount's IDs through m->mnt_parent while holding only namespace_sem for reading. For normal mounts this is safe because the namespace pins the parent, but for mounts that were detached with MNT_DETACH and kept alive only by a file descriptor, the parent can be freed concurrently by the final mntput() which operates under mount_lock alone. The fix checks whether the mount is still mounted; if so it reads the parent under namespace_sem as before, otherwise it acquires mount_lock (via scoped_guard) to safely read both parent IDs atomically, preventing the parent from being freed during the read. Any local user with a file descriptor on a detached mount can trigger this race.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 7.2 | 7.0 | 7.2.11 | 98fc6c7b6ca6 |
| mainline | 7.0 | 7.3 | bb4609405752 |