Skip to content

CVE-2024-39496 btrfs: zoned: fix use-after-free due to race with dev replace

HighCVSS 7.8 EPSS 0.29%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: partial
Technology
Linux KernelUbuntuDebian

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.

Upgrade path

10 packages: 9 fixed.

PackageAffectedFixed inStatus
debian/linux(Debian 12) < 6.1.99-1; = 6.1.27-1; = 6.1.37-1; = 6.1.38-1 +22 more 6.1.99-1 Fixed
debian/linux(Debian 13) < 6.9.7-1 6.9.7-1 Fixed
debian/linux(Debian 14) < 6.9.7-1 6.9.7-1 Fixed
Linux kernel < 6.1.95; < 6.6.35; < 6.9.6; < 6.10 +8 more 6.1.95, 6.6.35, 6.9.6, 6.10, 0090d6e1b210551e63cf43958dc7a1ec942cdde9, 092571ef9a812566c8f2c9038d9c2a64c49788d6, 17765964703b88d8befd899f8501150bb7e07e43, a0cc006f4214b87e70983c692e05bb36c59b5752 Fixed
ubuntu/linux(Ubuntu 22.04) < 5.15.0-122.132 5.15.0-122.132 Fixed
ubuntu/linux(Ubuntu 24.04) < 6.8.0-44.44 6.8.0-44.44 Fixed
ubuntu/linux-kvm(Ubuntu 22.04) < 5.15.0-1067.72 5.15.0-1067.72 Fixed
ubuntu/linux-raspi(Ubuntu 22.04) < 5.15.0-1063.66 5.15.0-1063.66 Fixed
ubuntu/linux-raspi(Ubuntu 24.04) < 6.8.0-1011.12 6.8.0-1011.12 Fixed
debian linux = 11.0 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
debian/linux(Debian:12) < 6.1.99-1 6.1.99-1
debian/linux(Debian:12) = 6.1.27-1 No fix listed
debian/linux(Debian:12) = 6.1.37-1 No fix listed
debian/linux(Debian:12) = 6.1.38-1 No fix listed
debian/linux(Debian:12) = 6.1.38-2 No fix listed
debian/linux(Debian:12) = 6.1.38-2~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.38-3 No fix listed
debian/linux(Debian:12) = 6.1.38-4 No fix listed
debian/linux(Debian:12) = 6.1.38-4~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.52-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.64-1 No fix listed
debian/linux(Debian:12) = 6.1.66-1 No fix listed
debian/linux(Debian:12) = 6.1.67-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.76-1 No fix listed
debian/linux(Debian:12) = 6.1.76-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.82-1 No fix listed
debian/linux(Debian:12) = 6.1.85-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.94-1 No fix listed
debian/linux(Debian:12) = 6.1.94-1~bpo11+1 No fix listed
Show 21 more
ProductAffected versionsFixed in
debian/linux(Debian:12) = 6.1.98-1 No fix listed
debian/linux(Debian:13) < 6.9.7-1 6.9.7-1
debian/linux(Debian:14) < 6.9.7-1 6.9.7-1
ubuntu/linux(Ubuntu:22.04) < 5.15.0-122.132 5.15.0-122.132
ubuntu/linux-kvm(Ubuntu:22.04) < 5.15.0-1067.72 5.15.0-1067.72
ubuntu/linux-raspi(Ubuntu:22.04) < 5.15.0-1063.66 5.15.0-1063.66
Linux kernel >= 5b316468983dfa9473ff0f1c42e4e30b4c267141, < 17765964703b88d8befd899f8501150bb7e07e43 17765964703b88d8befd899f8501150bb7e07e43
Linux kernel >= 5b316468983dfa9473ff0f1c42e4e30b4c267141, < 092571ef9a812566c8f2c9038d9c2a64c49788d6 092571ef9a812566c8f2c9038d9c2a64c49788d6
Linux kernel >= 5b316468983dfa9473ff0f1c42e4e30b4c267141, < a0cc006f4214b87e70983c692e05bb36c59b5752 a0cc006f4214b87e70983c692e05bb36c59b5752
Linux kernel >= 5b316468983dfa9473ff0f1c42e4e30b4c267141, < 0090d6e1b210551e63cf43958dc7a1ec942cdde9 0090d6e1b210551e63cf43958dc7a1ec942cdde9
Linux kernel = 5.11 No fix listed
Linux kernel < 6.1.95 6.1.95
Linux kernel < 6.6.35 6.6.35
Linux kernel < 6.9.6 6.9.6
Linux kernel < 6.10 6.10
ubuntu/linux(Ubuntu:24.04) < 6.8.0-44.44 6.8.0-44.44
ubuntu/linux-raspi(Ubuntu:24.04) < 6.8.0-1011.12 6.8.0-1011.12
debian linux = 11.0 No fix listed
Linux kernel >= 5.12, < 6.1.95 6.1.95
Linux kernel >= 6.2, < 6.6.35 6.6.35
Linux kernel >= 6.7, < 6.9.6 6.9.6

References