7.8high
btrfs: fix incorrect return value after changing leaf in lookup_extent_data_ref()
- Severity
- 7.8high CVSS:3.1 by Linux
- Exploit likelihood
- 0.13% (higher than 2% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: btrfs: fix incorrect return value after changing leaf in lookup_extent_data_ref() After commit 1618aa3c2e01 ("btrfs: simplify return variables in lookup_extent_data_ref()"), the err and ret variables were merged into a single ret variable. However, when btrfs_next_leaf() 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
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 1618aa3c2e0163f5ac34d514ae89474521910536 before 4125a194db4a6cf91f619f38788272651cb97dce, from 1618aa3c2e0163f5ac34d514ae89474521910536 before 450e6a685d0cad95b15f8af152057bd0bf79f50b, from 1618aa3c2e0163f5ac34d514ae89474521910536 before ab1e022379c3c811aa72da8eb0c7507859a1d0f5, from 1618aa3c2e0163f5ac34d514ae89474521910536 before 316fb1b3169efb081d2db910cbbfef445afa03b9, 6.10 Not affected: before 6.10, from 6.12.82 up to 6.12.*, from 6.18.23 up to 6.18.*, from 6.19.13 up to 6.19.*, from 7.0 up to * | CVE List |
| linux linux_kernel | from 6.10.1 before 6.12.82, from 6.13 before 6.18.23, from 6.19 before 6.19.13, 6.10, 7.0 | NVD |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: btrfs: fix incorrect return value after changing leaf in lookup_extent_data_ref() After commit 1618aa3c2e01 ("btrfs: simplify return variables in lookup_extent_data_ref()"), the err and ret variables were merged into a single ret variable. However, when btrfs_next_leaf() 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.
NVD (es)
En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: btrfs: corrige el valor de retorno incorrecto después de cambiar la hoja en lookup_extent_data_ref() Después del commit 1618aa3c2e01 (’btrfs: simplifica las variables de retorno en lookup_extent_data_ref()’), las variables err y ret se fusionaron en una única variable ret. Sin embargo, cuando btrfs_next_leaf() devuelve 0 (éxito), ret se sobrescribe de -ENOENT a 0. Si la primera clave en la siguiente hoja no coincide (diferente objectid o tipo), la función devuelve 0 en lugar de -ENOENT, haciendo que el llamador crea que la búsqueda tuvo éxito cuando no fue así. Esto puede llevar a operaciones en el elemento incorrecto del árbol de extensiones, potencialmente causando corrupción del árbol de extensiones. Corrige esto devolviendo -ENOENT directamente cuando la clave no coincide, en lugar de depender de la variable ret.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-31666 changed 2026-10-19 | CVE Terms of Use |
| NVD | CVE-2026-31666 changed 2026-11-11 | Public domain |