CVE-2026-142890: namei: don't assert S_ISDIR on a stale rcu-walk inode
In the Linux kernel, the following vulnerability has been resolved:
namei: don't assert SISDIR on a stale rcu-walk inode
lookupinodepermissionmayexec() asserts that it is only ever handed a directory, on the grounds that linkpathwalk() has already checked dcanlookup(). In rcu-walk that does not follow. stepinto() samples ->dinode and validates it against ->dseq, but linkpathwalk() loads ->dflags again afterwards, and nothing orders that load against changes of the dentry:
CPU0 (rcu-walk of "x/y") CPU1 stepinto(x) inode = x->dinode // regular file readseqcountretry(&x->dseq) == 0 nd->inode = inode unlink("x") ddelete() // x goes negative mkdir("x") dinstantiate() // same dentry dcanlookup(x) // true now maylookup() VFSBUGONINODE(!SISDIR(nd->inode->imode))
With CONFIGPREEMPTRCU the walker can be preempted in that window, so it is not limited to a few instructions. mkdir() only gets the same dentry back if the filesystem keeps negative dentries around. tmpfs doesn't, ext4 does.
Apart from the assertion the stale inode is harmless, and has been there since before the assertion was added: nd->seq no longer matches x->dseq, so lookupfast(), followdotdotrcu() and trytounlazy() all fail with -ECHILD and the walk is redone in ref-walk, whatever the permission check on the old inode said.
Keep the assertion for ref-walk, where the dentry is pinned and can't change type, and skip it for rcu-walk. No change for kernels without CONFIGDEBUGVFS.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.6
Event History
Frequently Asked Questions
What conditions are required to trigger the issue?
A path walk of "x/y" must race with removal of x followed by creation of a directory at x using the same dentry. The affected walk is an RCU walk, and CONFIG_PREEMPT_RCU can widen the race window by allowing the walker to be preempted.
Which filesystems are implicated by the described race?
The filesystem must retain negative dentries so that mkdir() can reuse the dentry. The description identifies ext4 as doing this and states that tmpfs does not.
What happens if the stale inode is encountered?
The stale inode itself is described as harmless because the path sequence no longer matches the dentry sequence. The problematic effect is the directory-mode assertion, which can be reached after the dentry has changed from a regular file to a directory.