CVE-2026-31519
Race Condition in Linux btrfs Subvolume Creation Causing Dentry Corruption
Publication date: 2026-04-22
Last updated on: 2026-04-28
Assigner: kernel.org
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | From 6.13 (inc) to 6.18.21 (exc) |
| linux | linux_kernel | From 6.19 (inc) to 6.19.11 (exc) |
| linux | linux_kernel | From 6.2 (inc) to 6.6.131 (exc) |
| linux | linux_kernel | From 6.7 (inc) to 6.12.80 (exc) |
| linux | linux_kernel | From 2.6.32.19 (inc) to 2.6.33 (exc) |
| linux | linux_kernel | From 2.6.33 (inc) to 6.1.168 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-476 | The product dereferences a pointer that it expects to be valid but is NULL. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability exists in the Linux kernel's btrfs filesystem, specifically related to the handling of subvolumes and orphan cleanup. When a subvolume is created, a flag called BTRFS_ROOT_ORPHAN_CLEANUP is not set properly. This leads to a situation where subvolumes can appear with broken dentries (directory entries), causing errors when listing or accessing them.
In this broken state, deleting the subvolume fails with an ENOENT error (indicating the entity does not exist), but attempts to create new files or subvolumes over it fail with an EEXIST error (indicating the entity already exists), sometimes even causing the filesystem to abort. The root cause is a race condition involving orphan cleanup and dentry cache management, where the orphan cleanup function btrfs_orphan_cleanup() is not triggered correctly on the first lookup, leading to negative dentries for valid subvolumes.
How can this vulnerability impact me? :
This vulnerability can cause subvolumes in the btrfs filesystem to become stuck in a broken state where they cannot be deleted or overwritten normally. This can lead to filesystem inconsistencies and operational issues, such as inability to manage subvolumes properly.
Specifically, users may encounter errors when trying to list, access, delete, or create files or subvolumes in affected directories. The filesystem may also abort operations due to these errors, potentially causing disruptions or data management difficulties.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability can be detected by observing broken subvolumes in the Btrfs filesystem. Specifically, listing the parent directory of the subvolume may show entries with question marks instead of normal permissions and ownership, for example:
- drwxrwxrwt 1 root root 16 Jan 23 16:49 .
- drwxr-xr-x 1 root root 24 Jan 23 16:48 ..
- d????????? ? ? ? ? ? broken_subvol
Additionally, attempting to stat the broken subvolume will fail. The kernel log (dmesg) will contain an error message similar to:
- "could not do orphan cleanup -2"
Therefore, commands to detect this issue include:
- ls -l /path/to/parent_dir # to observe broken dentries
- stat /path/to/broken_subvol # will fail
- dmesg | grep 'could not do orphan cleanup -2' # to find related kernel error messages
What immediate steps should I take to mitigate this vulnerability?
The vulnerability can be mitigated by dropping the dentry cache, which allows successful deletion of the affected subvolume.
This can be done by running the following command as root:
- echo 2 > /proc/sys/vm/drop_caches
After dropping the dentry cache, attempts to delete the broken subvolume should succeed.