CVE-2022-49075 in Linuxinfo

Summary

by MITRE • 02/26/2025

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

btrfs: fix qgroup reserve overflow the qgroup limit

We use extent_changeset->bytes_changed in qgroup_reserve_data() to record how many bytes we set for EXTENT_QGROUP_RESERVED state. Currently the bytes_changed is set as "unsigned int", and it will overflow if we try to fallocate a range larger than 4GiB. The result is we reserve less bytes and eventually break the qgroup limit.

Unlike regular buffered/direct write, which we use one changeset for each ordered extent, which can never be larger than 256M. For fallocate, we use one changeset for the whole range, thus it no longer respects the 256M per extent limit, and caused the problem.

The following example test script reproduces the problem:

$ cat qgroup-overflow.sh #!/bin/bash

DEV=/dev/sdj MNT=/mnt/sdj

mkfs.btrfs -f $DEV mount $DEV $MNT

# Set qgroup limit to 2GiB. btrfs quota enable $MNT btrfs qgroup limit 2G $MNT

# Try to fallocate a 3GiB file. This should fail. echo echo "Try to fallocate a 3GiB file..." fallocate -l 3G $MNT/3G.file

# Try to fallocate a 5GiB file. echo echo "Try to fallocate a 5GiB file..." fallocate -l 5G $MNT/5G.file

# See we break the qgroup limit. echo sync btrfs qgroup show -r $MNT

umount $MNT

When running the test:

$ ./qgroup-overflow.sh (...)

Try to fallocate a 3GiB file... fallocate: fallocate failed: Disk quota exceeded

Try to fallocate a 5GiB file...

qgroupid         rfer         excl     max_rfer --------         ----         ----     -------- 0/5           5.00GiB      5.00GiB      2.00GiB

Since we have no control of how bytes_changed is used, it's better to set it to u64.

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Analysis

by VulDB Data Team • 09/24/2025

The vulnerability CVE-2022-49075 affects the Linux kernel's btrfs file system implementation and represents a critical qgroup reservation overflow issue that can lead to quota limit circumvention. This flaw exists in the qgroup_reserve_data() function where the extent_changeset->bytes_changed field is declared as an unsigned int type, creating a fundamental arithmetic overflow condition when processing large fallocate operations exceeding 4GiB in size. The technical root cause stems from the design difference between regular file I/O operations and fallocate behavior, where buffered/direct writes utilize per-ordered-extent changesets capped at 256MiB limits, while fallocate operations employ a single changeset for the entire range, eliminating the natural size constraints that would otherwise prevent overflow conditions.

The operational impact of this vulnerability is significant as it allows malicious actors or system administrators to exceed qgroup quotas that have been explicitly configured to limit storage consumption. When a file is fallocated with a size greater than 4GiB, the unsigned int overflow causes the system to incorrectly track reserved bytes, resulting in insufficient quota accounting that eventually leads to quota limit violations. The test script provided demonstrates this clearly by showing that a 3GiB fallocate operation fails appropriately due to quota limits, while a 5GiB operation succeeds despite exceeding the configured 2GiB limit, as evidenced by the qgroup report showing 5GiB of referenced space with a maximum limit of only 2GiB. This represents a direct bypass of storage quota enforcement mechanisms that are fundamental to resource management and security policies in multi-tenant environments.

The vulnerability directly maps to CWE-191, Integer Underflow/Overflow, and aligns with ATT&CK technique T1490, Data Destruction, as it enables unauthorized consumption of storage resources beyond configured limits. The fix proposed involves changing the bytes_changed field from unsigned int to uint64_t type, which eliminates the overflow possibility by providing sufficient range to accommodate any reasonable file allocation size while maintaining the integrity of qgroup accounting mechanisms. This mitigation approach ensures that quota enforcement remains effective regardless of the size of fallocate operations performed on the btrfs file system, thereby preserving the intended security posture and resource management controls that depend on these quota limits for system stability and security. The solution addresses the fundamental design inconsistency between different I/O operation handling methods within the same file system implementation, preventing potential abuse scenarios where storage quotas could be systematically bypassed through carefully crafted large allocation operations.

Responsible

Linux

Reservation

02/26/2025

Disclosure

02/26/2025

Moderation

accepted

CPE

ready

EPSS

0.00233

KEV

no

Activities

very low

Sources

Do you know our Splunk app?

Download it now for free!