CVE-2024-42231

published 30 Jul 2024 · updated 11 May 2026

btrfs: zoned: fix calc_available_free_space() for zoned mode

5.0MediumEPSS 0%

No exploitation in the wild has been reported. EPSS puts the chance of exploitation in the next 30 days at 0%. Fixed in Kernel 64d2c847ba380e07b9072d65a50aa6469d2aa43f and Kernel 8548903b1999bba02a2b894ad750ab8eb1f40307.

In the Linux kernel, the following vulnerability has been resolved: btrfs: zoned: fix calc_available_free_space() for zoned mode calc_available_free_space() returns the total size of metadata (or system) block groups, which can be allocated from unallocated disk space. The logic is wrong on zoned mode in two places. First, the calculation of data_chunk_size is wrong. We always allocate one zone as one chunk, and no partial allocation of a zone. So, we should use zone_size (= data_sinfo->chunk_size) as it is. Second, the result "avail" may not be zone aligned. Since we always allocate one zone as one chunk on zoned mode, returning non-zone size aligned bytes will result in less pressure on the async metadata reclaim process. This is serious for the nearly full state with a large zone size device. Allowing over-commit too much will result in less async reclaim work and end up in ENOSPC. We can align down to the zone size to avoid that.

Affected

Vendors, products and packages with version ranges

VendorProductVersionsFixed
LinuxKernel=6.7, >=cb6cbab79055ca207ad88bc54226b48ececdcef0 <64d2c847ba380e07b9072d65a50aa6469d2aa43f, >=cb6cbab79055ca207ad88bc54226b48ececdcef0 <8548903b1999bba02a2b894ad750ab8eb1f4030764d2c847ba380e07b9072d65a50aa6469d2aa43f, 8548903b1999bba02a2b894ad750ab8eb1f40307

Timeline

Every event on this vulnerability

Related

Other vulnerabilities in Kernel, strongest first

Embed

A live severity badge for an advisory, README or ticket

CVE-2024-42231 severity on Zeptric[![CVE-2024-42231](https://zeptric.io/badge/cve/CVE-2024-42231.svg)](https://zeptric.io/cve/CVE-2024-42231)