CVE-2026-31666: btrfs: fix incorrect return value after changing leaf in lookup_extent_data_ref()
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix incorrect return value after changing leaf in lookupextentdataref()
After commit 1618aa3c2e01 ("btrfs: simplify return variables in lookupextentdataref()"), the err and ret variables were merged into a single ret variable. However, when btrfsnextleaf() returns 0 (success), ret is overwritten from -ENOENT to 0. If the first key in the next leaf does not match (different objectid or type), the function returns 0 instead of -ENOENT, making the caller believe the lookup succeeded when it did not. This can lead to operations on the wrong extent tree item, potentially causing extent tree corruption.
Fix this by returning -ENOENT directly when the key does not match, instead of relying on the ret variable.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-31666?
CVE-2026-31666 has been classified as a medium severity vulnerability.
How do I fix CVE-2026-31666?
To fix CVE-2026-31666, apply the relevant patches or updates provided for your version of the Linux kernel.
What impact does CVE-2026-31666 have on Linux kernel systems?
CVE-2026-31666 can lead to incorrect return values when changing leaf nodes, potentially affecting data integrity.
Which versions of the Linux kernel are affected by CVE-2026-31666?
CVE-2026-31666 affects various versions of the Linux kernel that utilize the btrfs filesystem.
Is CVE-2026-31666 actively exploited in the wild?
As of now, there is no known active exploitation reported for CVE-2026-31666.