5.5medium
btrfs: do not BUG_ON() when freeing tree block after error
- Severity
- 5.5medium CVSS:3.1 by NVD
- Exploit likelihood
- 0.24% (higher than 16% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: btrfs: do not BUG_ON() when freeing tree block after error When freeing a tree block, at btrfs_free_tree_block(), if we fail to create a delayed reference we don't deal with the error and just do a BUG_ON(). The error most likely to happen is -ENOMEM, and we have a comment mentioning that only -ENOMEM can happen, but that is not true, because in case qgroups are enabled any error returned from btrfs_qgroup_trace_extent_post() (can be -EUCLEAN or anything returned from btrfs_search_slot() for example) can be propagated back to btrfs_free_tree_block(). So stop doing a BUG_ON() and return the error to the callers and make them abort the transaction to prevent leaking space. Syzbot was triggering this, likely due to memory allocation failure injection.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from fb235dc06fac9eaa4408ade9c8b20d45d63c89b7 before bfcef12f80b3a9bd6b09c7305679164e3307328a, from fb235dc06fac9eaa4408ade9c8b20d45d63c89b7 before 22d907bcd283d69d5e60497fc0d51969545c583b, from fb235dc06fac9eaa4408ade9c8b20d45d63c89b7 before 98251cd60b4d702a8a81de442ab621e83a3fb24f, from fb235dc06fac9eaa4408ade9c8b20d45d63c89b7 before bb3868033a4cccff7be57e9145f2117cbdc91c11, 4.11 Not affected: before 4.11, from 6.1.191 up to 6.1.*, from 6.6.64 up to 6.6.*, from 6.10.5 up to 6.10.*, from 6.11 up to * | CVE List |
| linux linux_kernel | before 6.10.5 | NVD |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: btrfs: do not BUG_ON() when freeing tree block after error When freeing a tree block, at btrfs_free_tree_block(), if we fail to create a delayed reference we don't deal with the error and just do a BUG_ON(). The error most likely to happen is -ENOMEM, and we have a comment mentioning that only -ENOMEM can happen, but that is not true, because in case qgroups are enabled any error returned from btrfs_qgroup_trace_extent_post() (can be -EUCLEAN or anything returned from btrfs_search_slot() for example) can be propagated back to btrfs_free_tree_block(). So stop doing a BUG_ON() and return the error to the callers and make them abort the transaction to prevent leaking space. Syzbot was triggering this, likely due to memory allocation failure injection.
NVD (es)
En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: btrfs: no hacer BUG_ON() al liberar un bloque de árbol después de un error Al liberar un bloque de árbol, en btrfs_free_tree_block(), si no podemos crear una referencia retrasada, no nos ocupamos del error y simplemente hacemos un BUG_ON(). El error más probable que ocurra es -ENOMEM, y tenemos un comentario que menciona que solo puede ocurrir -ENOMEM, pero eso no es cierto, porque en caso de que los qgroups estén habilitados, cualquier error devuelto por btrfs_qgroup_trace_extent_post() (puede ser -EUCLEAN o cualquier cosa devuelta por btrfs_search_slot(), por ejemplo) se puede propagar de vuelta a btrfs_free_tree_block(). Así que deja de hacer un BUG_ON() y devuelve el error a los llamadores y haz que aborten la transacción para evitar fugas de espacio. Syzbot estaba activando esto, probablemente debido a la inyección de fallo de asignación de memoria.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-44963 changed 2026-10-30 | CVE Terms of Use |
| NVD | CVE-2024-44963 changed 2026-10-30 | Public domain |