CVE-2025-38306: fs/fhandle.c: fix a race in call of has_locked_children()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
fs/fhandle.c: fix a race in call of has_locked_children()
may_decode_fh() is calling has_locked_children() while holding no locks. That's an oopsable race...
The rest of the callers are safe since they are holding namespace_sem and are guaranteed a positive refcount on the mount in question.
Rename the current has_locked_children() to __has_locked_children(), make it static and switch the fs/namespace.c users to it.
Make has_locked_children() a wrapper for __has_locked_children(), calling the latter under read_seqlock_excl(&mount_lock).
The Linux kernel CVE team has assigned CVE-2025-38306 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.11 with commit 620c266f394932e5decc4b34683a75dfc59dc2f4 and fixed in 6.15.3 with commit 287c7d34eedd37af1272dfb3b6e8656f4f026424 Issue introduced in 6.11 with commit 620c266f394932e5decc4b34683a75dfc59dc2f4 and fixed in 6.16-rc1 with commit 1f282cdc1d219c4a557f7009e81bc792820d9d9a
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2025-38306
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
fs/namespace.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/287c7d34eedd37af1272dfb3b6e8656f4f026424 https://git.kernel.org/stable/c/1f282cdc1d219c4a557f7009e81bc792820d9d9a