{"id":"CVE-2024-42231","summary":"btrfs: zoned: fix calc_available_free_space() for zoned mode","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: zoned: fix calc_available_free_space() for zoned mode\n\ncalc_available_free_space() returns the total size of metadata (or\nsystem) block groups, which can be allocated from unallocated disk\nspace. The logic is wrong on zoned mode in two places.\n\nFirst, the calculation of data_chunk_size is wrong. We always allocate\none zone as one chunk, and no partial allocation of a zone. So, we\nshould use zone_size (= data_sinfo-\u003echunk_size) as it is.\n\nSecond, the result \"avail\" may not be zone aligned. Since we always\nallocate one zone as one chunk on zoned mode, returning non-zone size\naligned bytes will result in less pressure on the async metadata reclaim\nprocess.\n\nThis is serious for the nearly full state with a large zone size device.\nAllowing over-commit too much will result in less async reclaim work and\nend up in ENOSPC. We can align down to the zone size to avoid that.","modified":"2026-03-20T12:38:44.169127Z","published":"2024-07-30T07:47:11.409Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/42xxx/CVE-2024-42231.json"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/64d2c847ba380e07b9072d65a50aa6469d2aa43f"},{"type":"WEB","url":"https://git.kernel.org/stable/c/8548903b1999bba02a2b894ad750ab8eb1f40307"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/42xxx/CVE-2024-42231.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-42231"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"cb6cbab79055ca207ad88bc54226b48ececdcef0"},{"fixed":"8548903b1999bba02a2b894ad750ab8eb1f40307"},{"fixed":"64d2c847ba380e07b9072d65a50aa6469d2aa43f"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-42231.json"}}],"schema_version":"1.7.5"}