7.8high
btrfs: zoned: fix use-after-free due to race with dev replace
- Severity
- 7.8high CVSS:3.1 by Linux
- Exploit likelihood
- 0.29% (higher than 22% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: btrfs: zoned: fix use-after-free due to race with dev replace While loading a zone's info during creation of a block group, we can race with a device replace operation and then trigger a use-after-free on the device that was just replaced (source device of the replace operation). This happens because at btrfs_load_zone_info() we extract a device from the chunk map into a local variable and then use the device while not under the protection of the device replace rwsem. So if there's a device replace operation happening when we extract the device and that device is the source of the replace operation, we will trigger a use-after-free if before we finish using the device the replace operation finishes and frees the device. Fix this by enlarging the critical section under the protection of the device replace rwsem so that all uses of the device are done inside the critical section.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 5b316468983dfa9473ff0f1c42e4e30b4c267141 before 17765964703b88d8befd899f8501150bb7e07e43, from 5b316468983dfa9473ff0f1c42e4e30b4c267141 before 092571ef9a812566c8f2c9038d9c2a64c49788d6, from 5b316468983dfa9473ff0f1c42e4e30b4c267141 before a0cc006f4214b87e70983c692e05bb36c59b5752, from 5b316468983dfa9473ff0f1c42e4e30b4c267141 before 0090d6e1b210551e63cf43958dc7a1ec942cdde9, 5.11 Not affected: before 5.11, from 6.1.95 up to 6.1.*, from 6.6.35 up to 6.6.*, from 6.9.6 up to 6.9.*, from 6.10 up to * | CVE List |
| debian debian_linux | 11.0 | NVD |
| linux linux_kernel | from 5.12 before 6.1.95, from 6.2 before 6.6.35, from 6.7 before 6.9.6 | NVD |
All scores
| Linux | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
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: zoned: fix use-after-free due to race with dev replace While loading a zone's info during creation of a block group, we can race with a device replace operation and then trigger a use-after-free on the device that was just replaced (source device of the replace operation). This happens because at btrfs_load_zone_info() we extract a device from the chunk map into a local variable and then use the device while not under the protection of the device replace rwsem. So if there's a device replace operation happening when we extract the device and that device is the source of the replace operation, we will trigger a use-after-free if before we finish using the device the replace operation finishes and frees the device. Fix this by enlarging the critical section under the protection of the device replace rwsem so that all uses of the device are done inside the critical section.
NVD (es)
En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: btrfs:zoned: corrige el use-after-free debido a la ejecución con el reemplazo de desarrollo. Mientras cargamos la información de una zona durante la creación de un grupo de bloques, podemos ejecutar una operación de reemplazo de dispositivo y luego activar un use-after-free en el dispositivo que acaba de ser reemplazado (dispositivo fuente de la operación de reemplazo). Esto sucede porque en btrfs_load_zone_info() extraemos un dispositivo del mapa de fragmentos en una variable local y luego usamos el dispositivo mientras no está bajo la protección del dispositivo y reemplazamos rwsem. Entonces, si se produce una operación de reemplazo de dispositivo cuando extraemos el dispositivo y ese dispositivo es la fuente de la operación de reemplazo, activaremos un use-after-free si antes de terminar de usar el dispositivo la operación de reemplazo finaliza y libera el dispositivo. Solucione este problema ampliando la sección crítica bajo la protección del dispositivo y reemplace rwsem para que todos los usos del dispositivo se realicen dentro de la sección crítica.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-39496 changed 2026-08-05 | CVE Terms of Use |
| NVD | CVE-2024-39496 changed 2026-08-04 | Public domain |