{"id":"CVE-2026-31666","revision":"490272b3baca4d51827809862b1cacfd","records":[{"revision":"490272b3baca4d51827809862b1cacfd","observedAt":"2026-10-23T15:48:27.903+00:00","statement":{"source":"cve-program","id":"CVE-2026-31666","aliases":[],"title":"btrfs: fix incorrect return value after changing leaf in lookup_extent_data_ref()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix incorrect return value after changing leaf in lookup_extent_data_ref()\n\nAfter commit 1618aa3c2e01 (\"btrfs: simplify return variables in\nlookup_extent_data_ref()\"), the err and ret variables were merged into\na single ret variable. However, when btrfs_next_leaf() returns 0\n(success), ret is overwritten from -ENOENT to 0. If the first key in\nthe next leaf does not match (different objectid or type), the function\nreturns 0 instead of -ENOENT, making the caller believe the lookup\nsucceeded when it did not. This can lead to operations on the wrong\nextent tree item, potentially causing extent tree corruption.\n\nFix this by returning -ENOENT directly when the key does not match,\ninstead of relying on the ret variable.","state":0,"publishedAt":"2026-04-24T14:45:15.271+00:00","modifiedAt":"2026-10-19T18:56:02.816+00:00","affected":[{"ecosystem":"Vendor product","name":"Linux","ranges":[],"versions":[],"rawVersionEvidence":"{\n                    \"product\": \"Linux\",\n                    \"vendor\": \"Linux\",\n                    \"defaultStatus\": \"unaffected\",\n                    \"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\",\n                    \"programFiles\": [\n                        \"fs/btrfs/extent-tree.c\"\n                    ],\n                    \"versions\": [\n                        {\n                            \"version\": \"1618aa3c2e0163f5ac34d514ae89474521910536\",\n                            \"lessThan\": \"4125a194db4a6cf91f619f38788272651cb97dce\",\n                            \"status\": \"affected\",\n                            \"versionType\": \"git\"\n                        },\n                        {\n                            \"version\": \"1618aa3c2e0163f5ac34d514ae89474521910536\",\n                            \"lessThan\": \"450e6a685d0cad95b15f8af152057bd0bf79f50b\",\n                            \"status\": \"affected\",\n                            \"versionType\": \"git\"\n                        },\n                        {\n                            \"version\": \"1618aa3c2e0163f5ac34d514ae89474521910536\",\n                            \"lessThan\": \"ab1e022379c3c811aa72da8eb0c7507859a1d0f5\",\n                            \"status\": \"affected\",\n                            \"versionType\": \"git\"\n                        },\n                        {\n                            \"version\": \"1618aa3c2e0163f5ac34d514ae89474521910536\",\n                            \"lessThan\": \"316fb1b3169efb081d2db910cbbfef445afa03b9\",\n                            \"status\": \"affected\",\n                            \"versionType\": \"git\"\n                        }\n                    ]\n                }"},{"ecosystem":"Vendor product","name":"Linux","ranges":[],"versions":[],"rawVersionEvidence":"{\n                    \"product\": \"Linux\",\n                    \"vendor\": \"Linux\",\n                    \"defaultStatus\": \"affected\",\n                    \"repo\": \"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\",\n                    \"programFiles\": [\n                        \"fs/btrfs/extent-tree.c\"\n                    ],\n                    \"versions\": [\n                        {\n                            \"version\": \"6.10\",\n                            \"status\": \"affected\"\n                        },\n                        {\n                            \"version\": \"0\",\n                            \"lessThan\": \"6.10\",\n                            \"status\": \"unaffected\",\n                            \"versionType\": \"semver\"\n                        },\n                        {\n                            \"version\": \"6.12.82\",\n                            \"lessThanOrEqual\": \"6.12.*\",\n                            \"status\": \"unaffected\",\n                            \"versionType\": \"semver\"\n                        },\n                        {\n                            \"version\": \"6.18.23\",\n                            \"lessThanOrEqual\": \"6.18.*\",\n                            \"status\": \"unaffected\",\n                            \"versionType\": \"semver\"\n                        },\n                        {\n                            \"version\": \"6.19.13\",\n                            \"lessThanOrEqual\": \"6.19.*\",\n                            \"status\": \"unaffected\",\n                            \"versionType\": \"semver\"\n                        },\n                        {\n                            \"version\": \"7.0\",\n                            \"lessThanOrEqual\": \"*\",\n                            \"status\": \"unaffected\",\n                            \"versionType\": \"original_commit_for_fix\"\n                        }\n                    ]\n                }"}],"metrics":[{"system":"CVSS 3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"severity":"HIGH"}],"references":["https://git.kernel.org/stable/c/4125a194db4a6cf91f619f38788272651cb97dce","https://git.kernel.org/stable/c/450e6a685d0cad95b15f8af152057bd0bf79f50b","https://git.kernel.org/stable/c/ab1e022379c3c811aa72da8eb0c7507859a1d0f5","https://git.kernel.org/stable/c/316fb1b3169efb081d2db910cbbfef445afa03b9"],"sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-31666","license":"CVE Program Terms of Use","key":"cve-program:CVE-2026-31666","identifiers":["CVE-2026-31666"]},"retained":false,"historicalAffected":[]}],"coverage":[]}