CVE-2024-42231

Source
https://nvd.nist.gov/vuln/detail/CVE-2024-42231
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-42231.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-42231
Downstream
Published
2024-07-30T07:47:11Z
Modified
2025-10-17T09:46:59.281525Z
Summary
btrfs: zoned: fix calc_available_free_space() for zoned mode
Details

In the Linux kernel, the following vulnerability has been resolved:

btrfs: zoned: fix calcavailablefree_space() for zoned mode

calcavailablefree_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 datachunksize is wrong. We always allocate one zone as one chunk, and no partial allocation of a zone. So, we should use zonesize (= datasinfo->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.

References

Affected packages

Git / 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
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
cb6cbab79055ca207ad88bc54226b48ececdcef0
Fixed
64d2c847ba380e07b9072d65a50aa6469d2aa43f

Affected versions

v6.*

v6.6
v6.6-rc6
v6.6-rc7
v6.7
v6.7-rc1
v6.7-rc2
v6.7-rc3
v6.7-rc4
v6.7-rc5
v6.7-rc6
v6.7-rc7
v6.7-rc8
v6.8
v6.8-rc1
v6.8-rc2
v6.8-rc3
v6.8-rc4
v6.8-rc5
v6.8-rc6
v6.8-rc7
v6.9
v6.9-rc1
v6.9-rc2
v6.9-rc3
v6.9-rc4
v6.9-rc5
v6.9-rc6
v6.9-rc7
v6.9.1
v6.9.2
v6.9.3
v6.9.4
v6.9.5
v6.9.6
v6.9.7
v6.9.8

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.9.9