{"api_version":"1","generated_at":"2026-04-25T14:02:07+00:00","cve":"CVE-2026-31666","urls":{"html":"https://cve.report/CVE-2026-31666","api":"https://cve.report/api/cve/CVE-2026-31666.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-31666","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-31666"},"summary":{"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":"PUBLISHED","assigner":"Linux","published_at":"2026-04-24 15:16:46","updated_at":"2026-04-24 17:51:40"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/ab1e022379c3c811aa72da8eb0c7507859a1d0f5","name":"https://git.kernel.org/stable/c/ab1e022379c3c811aa72da8eb0c7507859a1d0f5","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/316fb1b3169efb081d2db910cbbfef445afa03b9","name":"https://git.kernel.org/stable/c/316fb1b3169efb081d2db910cbbfef445afa03b9","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/4125a194db4a6cf91f619f38788272651cb97dce","name":"https://git.kernel.org/stable/c/4125a194db4a6cf91f619f38788272651cb97dce","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/450e6a685d0cad95b15f8af152057bd0bf79f50b","name":"https://git.kernel.org/stable/c/450e6a685d0cad95b15f8af152057bd0bf79f50b","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-31666","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31666","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 1618aa3c2e0163f5ac34d514ae89474521910536 4125a194db4a6cf91f619f38788272651cb97dce git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 1618aa3c2e0163f5ac34d514ae89474521910536 450e6a685d0cad95b15f8af152057bd0bf79f50b git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 1618aa3c2e0163f5ac34d514ae89474521910536 ab1e022379c3c811aa72da8eb0c7507859a1d0f5 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 1618aa3c2e0163f5ac34d514ae89474521910536 316fb1b3169efb081d2db910cbbfef445afa03b9 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 6.10","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.10 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.12.82 6.12.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.18.23 6.18.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.19.13 6.19.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.0 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"defaultStatus":"unaffected","product":"Linux","programFiles":["fs/btrfs/extent-tree.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"4125a194db4a6cf91f619f38788272651cb97dce","status":"affected","version":"1618aa3c2e0163f5ac34d514ae89474521910536","versionType":"git"},{"lessThan":"450e6a685d0cad95b15f8af152057bd0bf79f50b","status":"affected","version":"1618aa3c2e0163f5ac34d514ae89474521910536","versionType":"git"},{"lessThan":"ab1e022379c3c811aa72da8eb0c7507859a1d0f5","status":"affected","version":"1618aa3c2e0163f5ac34d514ae89474521910536","versionType":"git"},{"lessThan":"316fb1b3169efb081d2db910cbbfef445afa03b9","status":"affected","version":"1618aa3c2e0163f5ac34d514ae89474521910536","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["fs/btrfs/extent-tree.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"6.10"},{"lessThan":"6.10","status":"unaffected","version":"0","versionType":"semver"},{"lessThanOrEqual":"6.12.*","status":"unaffected","version":"6.12.82","versionType":"semver"},{"lessThanOrEqual":"6.18.*","status":"unaffected","version":"6.18.23","versionType":"semver"},{"lessThanOrEqual":"6.19.*","status":"unaffected","version":"6.19.13","versionType":"semver"},{"lessThanOrEqual":"*","status":"unaffected","version":"7.0","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.12.82","versionStartIncluding":"6.10","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.18.23","versionStartIncluding":"6.10","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.19.13","versionStartIncluding":"6.10","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.0","versionStartIncluding":"6.10","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"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."}],"providerMetadata":{"dateUpdated":"2026-04-24T14:45:15.271Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/4125a194db4a6cf91f619f38788272651cb97dce"},{"url":"https://git.kernel.org/stable/c/450e6a685d0cad95b15f8af152057bd0bf79f50b"},{"url":"https://git.kernel.org/stable/c/ab1e022379c3c811aa72da8eb0c7507859a1d0f5"},{"url":"https://git.kernel.org/stable/c/316fb1b3169efb081d2db910cbbfef445afa03b9"}],"title":"btrfs: fix incorrect return value after changing leaf in lookup_extent_data_ref()","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-31666","datePublished":"2026-04-24T14:45:15.271Z","dateReserved":"2026-03-09T15:48:24.129Z","dateUpdated":"2026-04-24T14:45:15.271Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-04-24 15:16:46","lastModifiedDate":"2026-04-24 17:51:40","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"31666","Ordinal":"1","Title":"btrfs: fix incorrect return value after changing leaf in lookup_","CVE":"CVE-2026-31666","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"31666","Ordinal":"1","NoteData":"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.","Type":"Description","Title":"btrfs: fix incorrect return value after changing leaf in lookup_"}]}}}