Vulnerability · Published May 20, 2024 · Assigned by Linux

CVE-2024-35956btrfs: qgroup: fix qgroup prealloc rsv leak in subvolume operations

Medium 5.5

In plain English

A medium-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 14% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS NVD)5.5Medium
Exploit odds (30 days)0.2%top 86.2% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

In the Linux kernel, the following vulnerability has been resolved: btrfs: qgroup: fix qgroup prealloc rsv leak in subvolume operations Create subvolume, create snapshot and delete subvolume all use btrfs_subvolume_reserve_metadata() to reserve metadata for the changes done to the parent subvolume's fs tree, which cannot be mediated in the normal way via start_transaction. When quota groups (squota or qgroups) are enabled, this reserves qgroup metadata of type PREALLOC. Once the operation is associated to a transaction, we convert PREALLOC to PERTRANS, which gets cleared in bulk at the end of the transaction. However, the error paths of these three operations were not implementing this lifecycle correctly. They unconditionally converted the PREALLOC to PERTRANS in a generic cleanup step regardless of errors or whether the operation was fully associated to a transaction or not. This resulted in error paths occasionally converting this rsv to PERTRANS without calling record_root_in_trans successfully, which meant that unless that root got recorded in the transaction by some other thread, the end of the transaction would not free that root's PERTRANS, leaking it. Ultimately, this resulted in hitting a WARN in CONFIG_BTRFS_DEBUG builds at unmount for the leaked reservation. The fix is to ensure that every qgroup PREALLOC reservation observes the following properties: 1. any failure before record_root_in_trans is called successfully results in freeing the PREALLOC reservation. 2. after record_root_in_trans, we convert to PERTRANS, and now the transaction owns freeing the reservation. This patch enforces those properties on the three operations. Without it, generic/269 with squotas enabled at mkfs time would fail in ~5-10 runs on my system. With this patch, it ran successfully 1000 times in a row.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12linux6.1.123-1DEBIAN-CVE-2024-35956
Debian:13linux6.8.9-1DEBIAN-CVE-2024-35956
Debian:14linux6.8.9-1DEBIAN-CVE-2024-35956
Ubuntu:22.04:LTSlinuxno fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux6.8.0-38.38UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-awsno fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-aws6.8.0-1011.12UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-aws-6.86.8.0-1011.12~22.04.1UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-azureno fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-azure6.8.0-1010.10UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-azure-6.86.8.0-1010.10~22.04.1UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-azure-fdeno fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-gcpno fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-gcp6.8.0-1010.11UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-gkeno fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-gke6.8.0-1006.9UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-gkeopno fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-ibmno fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-ibm6.8.0-1008.8UBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-intel6.8.0-1007.14UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-intel-iot-realtimeno fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-intel-iotgno fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-kvmno fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-lowlatencyno fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-lowlatency6.8.0-38.38.1UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-nvidiano fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-nvidia6.8.0-1009.9UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-nvidia-6.86.8.0-1009.9~22.04.1UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-nvidia-tegrano fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-nvidia-tegra-igxno fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-oem-6.86.8.0-1008.8UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-oracleno fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-oracle6.8.0-1008.8UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-oracle-6.86.8.0-1008.8~22.04.1UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-raspino fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-raspi6.8.0-1007.7UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2024-35956
Ubuntu:24.04:LTSlinux-riscv6.8.0-38.38.1UBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2024-35956
Ubuntu:22.04:LTSlinux-xilinx-zynqmpno fix listedUBUNTU-CVE-2024-35956

Affected products (as reported)

VendorProductVersions
Linux Linux e85fde5162bf1b242cbd6daf7dba0f9b457d592b – before 945559be6e282a812dc48f7bcd5adc60901ea4a0e85fde5162bf1b242cbd6daf7dba0f9b457d592b – before 14431815a4ae4bcd7c7a68b6a64c66c7712d27c9e85fde5162bf1b242cbd6daf7dba0f9b457d592b – before 6c95336f5d8eb9ab79cd7306d71b6d0477363f8ce85fde5162bf1b242cbd6daf7dba0f9b457d592b – before 74e97958121aa1f5854da6effba70143f051b0cd2978cb474745b2d93c263008d265e899857060945.9.5 – before 5.10
Linux Linux 5.10

References