CVE-2023-54158: btrfs: don't free qgroup space unless specified
In the Linux kernel, the following vulnerability has been resolved:
btrfs: don't free qgroup space unless specified
Boris noticed in his simple quotas testing that he was getting a leak
with Sweet Tea's change to subvol create that stopped doing a
transaction commit. This was just a side effect of that change.
In the delayed inode code we have an optimization that will free extra
reservations if we think we can pack a dir item into an already modified
leaf. Previously this wouldn't be triggered in the subvolume create
case because we'd commit the transaction, it was still possible but
much harder to trigger. It could actually be triggered if we did a
mkdir && subvol create with qgroups enabled.
This occurs because in btrfs_insert_delayed_dir_index(), which gets
called when we're adding the dir item, we do the following:
btrfs_block_rsv_release(fs_info, trans->block_rsv, bytes, NULL);
if we're able to skip reserving space.
The problem here is that trans->block_rsv points at the temporary block
rsv for the subvolume create, which has qgroup reservations in the block
rsv.
This is a problem because btrfs_block_rsv_release() will do the
following:
if (block_rsv->qgroup_rsv_reserved >= block_rsv->qgroup_rsv_size) {
qgroup_to_release = block_rsv->qgroup_rsv_reserved -
block_rsv->qgroup_rsv_size;
block_rsv->qgroup_rsv_reserved = block_rsv->qgroup_rsv_size;
}
The temporary block rsv just has ->qgroup_rsv_reserved set,
->qgroup_rsv_size == 0. The optimization in
btrfs_insert_delayed_dir_index() sets ->qgroup_rsv_reserved = 0. Then
later on when we call btrfs_subvolume_release_metadata() which has
btrfs_block_rsv_release(fs_info, rsv, (u64)-1, &qgroup_to_release);
btrfs_qgroup_convert_reserved_meta(root, qgroup_to_release);
qgroup_to_release is set to 0, and we do not convert the reserved
metadata space.
The problem here is that the block rsv code has been unconditionally
messing with ->qgroup_rsv_reserved, because the main place this is used
is delalloc, and any time we call btrfs_block_rsv_release() we do it
with qgroup_to_release set, and thus do the proper accounting.
The subvolume code is the only other code that uses the qgroup
reservation stuff, but it's intermingled with the above optimization,
and thus was getting its reservation freed out from underneath it and
thus leaking the reserved space.
The solution is to simply not mess with the qgroup reservations if we
don't have qgroup_to_release set. This works with the existing code as
anything that messes with the delalloc reservations always have
qgroup_to_release set. This fixes the leak that Boris was observing.
Security readout for executives and security teams
Plain-English summary
This Linux kernel btrfs issue can leak reserved quota-group metadata space during subvolume creation. The known business impact is availability or operational degradation for systems relying on btrfs quotas, not confirmed data theft or privilege escalation. Severity is not scored in the provided sources.
Executive priority
Treat as a targeted Linux storage reliability issue. Prioritize patching where btrfs quotas are used in production, containers, backup platforms, or multi-tenant storage. Broader emergency response is not supported by the supplied evidence.
Technical view
The bug is in btrfs quota-group accounting. When delayed directory index insertion releases block reservation space without a qgroup release pointer, it can zero qgroup reserved metadata and prevent later conversion during subvolume metadata release, leaking reserved space.
Likely exposure
Exposure is most relevant to Linux systems using btrfs with qgroups enabled, especially workloads creating directories and subvolumes. The source lists affected Linux kernel versions and stable-series fixes, but provides no CPEs or distro-specific package mapping.
Exploitation context
The provided sources describe a correctness and resource-accounting leak found during quota testing. KEV is false, and no cited source states active exploitation, public exploit availability, or a remote attack path.
Researcher notes
The fix changes block reservation release behavior so qgroup reservations are not modified unless qgroup_to_release is provided. Evidence is kernel-maintainer text and stable commits; no CVSS, CWE, exploitability analysis, or distro status is included.
Mitigation direction
Apply Linux kernel updates containing the referenced stable btrfs fixes.
Prioritize hosts using btrfs quota groups and subvolume-heavy workflows.
Check distribution vendor advisories for backported fixed kernel packages.
Avoid relying on unsupported kernels for btrfs quota workloads.
If patch timing is constrained, seek vendor guidance for operational workarounds.
Validation and detection
Inventory Linux kernel versions on systems using btrfs.
Identify btrfs filesystems with qgroups enabled.
Map installed kernels to vendor advisories or referenced stable commits.
Review monitoring for quota metadata reservation growth or unexplained quota exhaustion.
Confirm patched kernels include the btrfs qgroup reservation fix.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2023-54158 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
0CVSS vectors
3Timeline events
0ADP providers
8Source links
Vulnerability timeline
Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.
CVE reservedCVE Program
The CVE ID was reserved by the assigning CNA.
CVE publishedCVE Program
The CVE record was published.
Dec 24, 2025, 13:07 UTC (UTC+00:00)
CVE updatedCVE Program
The CVE record metadata indicates this as the latest update time.