CVE-2024-42231 btrfs: zoned: fix calc_available_free_space() for zoned mode
Incorrect space calculation in btrfs zoned mode can cause premature ENOSPC errors, leading to denial of service on nearly full filesystems.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-42231?
CVE-2024-42231 is a medium-severity denial of service vulnerability in Linux kernel, published on 30 Jul 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
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.
Weakness: CWE-682
Which versions are affected by CVE-2024-42231?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2024-42231?
Apply the vendor's patch.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2024-42231 being exploited?
There is no known exploitation of CVE-2024-42231 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as BELL-CVE-2024-42231, DEBIAN-CVE-2024-42231, GHSA-hmvx-mw63-jvg7, UBUNTU-CVE-2024-42231.