CVE-2024-35956
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
20/05/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
btrfs: qgroup: fix qgroup prealloc rsv leak in subvolume operations<br />
<br />
Create subvolume, create snapshot and delete subvolume all use<br />
btrfs_subvolume_reserve_metadata() to reserve metadata for the changes<br />
done to the parent subvolume&#39;s fs tree, which cannot be mediated in the<br />
normal way via start_transaction. When quota groups (squota or qgroups)<br />
are enabled, this reserves qgroup metadata of type PREALLOC. Once the<br />
operation is associated to a transaction, we convert PREALLOC to<br />
PERTRANS, which gets cleared in bulk at the end of the transaction.<br />
<br />
However, the error paths of these three operations were not implementing<br />
this lifecycle correctly. They unconditionally converted the PREALLOC to<br />
PERTRANS in a generic cleanup step regardless of errors or whether the<br />
operation was fully associated to a transaction or not. This resulted in<br />
error paths occasionally converting this rsv to PERTRANS without calling<br />
record_root_in_trans successfully, which meant that unless that root got<br />
recorded in the transaction by some other thread, the end of the<br />
transaction would not free that root&#39;s PERTRANS, leaking it. Ultimately,<br />
this resulted in hitting a WARN in CONFIG_BTRFS_DEBUG builds at unmount<br />
for the leaked reservation.<br />
<br />
The fix is to ensure that every qgroup PREALLOC reservation observes the<br />
following properties:<br />
<br />
1. any failure before record_root_in_trans is called successfully<br />
results in freeing the PREALLOC reservation.<br />
2. after record_root_in_trans, we convert to PERTRANS, and now the<br />
transaction owns freeing the reservation.<br />
<br />
This patch enforces those properties on the three operations. Without<br />
it, generic/269 with squotas enabled at mkfs time would fail in ~5-10<br />
runs on my system. With this patch, it ran successfully 1000 times in a<br />
row.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.9.5 (including) | 6.1.120 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.28 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.8.7 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc3:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/14431815a4ae4bcd7c7a68b6a64c66c7712d27c9
- https://git.kernel.org/stable/c/6c95336f5d8eb9ab79cd7306d71b6d0477363f8c
- https://git.kernel.org/stable/c/74e97958121aa1f5854da6effba70143f051b0cd
- https://git.kernel.org/stable/c/945559be6e282a812dc48f7bcd5adc60901ea4a0
- https://git.kernel.org/stable/c/14431815a4ae4bcd7c7a68b6a64c66c7712d27c9
- https://git.kernel.org/stable/c/6c95336f5d8eb9ab79cd7306d71b6d0477363f8c
- https://git.kernel.org/stable/c/74e97958121aa1f5854da6effba70143f051b0cd
- https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html



