Vulnerability · Published Jan 11, 2025 · Assigned by Linux

CVE-2024-57806btrfs: fix transaction atomicity bug when enabling simple quotas

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 12% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS NVD)5.5Medium
Exploit odds (30 days)0.2%top 87.8% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack toolingNoneno public tooling known

Official description

In the Linux kernel, the following vulnerability has been resolved: btrfs: fix transaction atomicity bug when enabling simple quotas Set squota incompat bit before committing the transaction that enables the feature. With the config CONFIG_BTRFS_ASSERT enabled, an assertion failure occurs regarding the simple quota feature. [5.596534] assertion failed: btrfs_fs_incompat(fs_info, SIMPLE_QUOTA), in fs/btrfs/qgroup.c:365 [5.597098] ------------[ cut here ]------------ [5.597371] kernel BUG at fs/btrfs/qgroup.c:365! [5.597946] CPU: 1 UID: 0 PID: 268 Comm: mount Not tainted 6.13.0-rc2-00031-gf92f4749861b #146 [5.598450] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 [5.599008] RIP: 0010:btrfs_read_qgroup_config+0x74d/0x7a0 [5.604303] <TASK> [5.605230] ? btrfs_read_qgroup_config+0x74d/0x7a0 [5.605538] ? exc_invalid_op+0x56/0x70 [5.605775] ? btrfs_read_qgroup_config+0x74d/0x7a0 [5.606066] ? asm_exc_invalid_op+0x1f/0x30 [5.606441] ? btrfs_read_qgroup_config+0x74d/0x7a0 [5.606741] ? btrfs_read_qgroup_config+0x74d/0x7a0 [5.607038] ? try_to_wake_up+0x317/0x760 [5.607286] open_ctree+0xd9c/0x1710 [5.607509] btrfs_get_tree+0x58a/0x7e0 [5.608002] vfs_get_tree+0x2e/0x100 [5.608224] fc_mount+0x16/0x60 [5.608420] btrfs_get_tree+0x2f8/0x7e0 [5.608897] vfs_get_tree+0x2e/0x100 [5.609121] path_mount+0x4c8/0xbc0 [5.609538] __x64_sys_mount+0x10d/0x150 The issue can be easily reproduced using the following reproducer: root@q:linux# cat repro.sh set -e mkfs.btrfs -q -f /dev/sdb mount /dev/sdb /mnt/btrfs btrfs quota enable -s /mnt/btrfs umount /mnt/btrfs mount /dev/sdb /mnt/btrfs The issue is that when enabling quotas, at btrfs_quota_enable(), we set BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE at fs_info->qgroup_flags and persist it in the quota root in the item with the key BTRFS_QGROUP_STATUS_KEY, but we only set the incompat bit BTRFS_FEATURE_INCOMPAT_SIMPLE_QUOTA after we commit the transaction used to enable simple quotas. This means that if after that transaction commit we unmount the filesystem without starting and committing any other transaction, or we have a power failure, the next time we mount the filesystem we will find the flag BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE set in the item with the key BTRFS_QGROUP_STATUS_KEY but we will not find the incompat bit BTRFS_FEATURE_INCOMPAT_SIMPLE_QUOTA set in the superblock, triggering an assertion failure at: btrfs_read_qgroup_config() -> qgroup_read_enable_gen() To fix this issue, set the BTRFS_FEATURE_INCOMPAT_SIMPLE_QUOTA flag immediately after setting the BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE. This ensures that both flags are flushed to disk within the same transaction.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:13linux6.12.8-1DEBIAN-CVE-2024-57806
Debian:14linux6.12.8-1DEBIAN-CVE-2024-57806
Ubuntu:24.04:LTSlinux6.8.0-60.63UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-aws6.8.0-1029.31UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-aws-6.86.8.0-1029.31~22.04.1UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-azure6.8.0-1029.34UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-azure-6.116.11.0-1012.12~24.04.1UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-azure-6.86.8.0-1029.34~22.04.1UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-azure-nvidia6.8.0-1016.17UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-gcp6.8.0-1030.32UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-gcp-6.116.11.0-1011.11~24.04.1UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-gcp-6.86.8.0-1030.32~22.04.1UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-gke6.8.0-1025.29UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-gkeop6.8.0-1012.14UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-hwe-6.116.11.0-21.21~24.04.1UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-hwe-6.86.8.0-60.63~22.04.1UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-ibm6.8.0-1026.26UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-ibm-6.86.8.0-1026.26~22.04.1UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-intel-iot-realtimeno fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-lowlatency6.8.0-60.63.1UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.86.8.0-60.63.1~22.04.1UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-nvidia6.8.0-1028.31UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-nvidia-6.116.11.0-1007.7UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-nvidia-6.86.8.0-1028.31~22.04.1UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-nvidia-lowlatency6.8.0-1028.31.1UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-nvidia-tegra6.8.0-1008.8UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-oem-6.116.11.0-1017.17UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-oem-6.86.8.0-1028.28UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-oracle6.8.0-1026.27UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-oracle-6.86.8.0-1026.27~22.04.1UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-raspi6.8.0-1028.32UBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-raspi-realtimeno fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-riscv6.8.0-60.63.1UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-riscv-6.86.8.0-62.65~22.04.1UBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2024-57806
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2024-57806
Ubuntu:24.04:LTSlinux-xilinx6.8.0-1017.18UBUNTU-CVE-2024-57806

Affected products (as reported)

VendorProductVersions
Linux Linux 182940f4f4dbd932776414744c8de64333957725 – before b87c9b9ba05ba6e8e2ee9ecd29a8c930b35648ed182940f4f4dbd932776414744c8de64333957725 – before f2363e6fcc7938c5f0f6ac066fad0dd247598b51
Linux Linux 6.7

References