LiveActive security incident?Get immediate response
CVE Record

CVE-2022-49999: btrfs: fix space cache corruption and potential double allocations

In the Linux kernel, the following vulnerability has been resolved: btrfs: fix space cache corruption and potential double allocations When testing space_cache v2 on a large set of machines, we encountered a few symptoms: 1. "unable to add free space :-17" (EEXIST) errors. 2. Missing free space info items, sometimes caught with a "missing free space info for X" error. 3. Double-accounted space: ranges that were allocated in the extent tree and also marked as free in the free space tree, ranges that were marked as allocated twice in the extent tree, or ranges that were marked as free twice in the free space tree. If the latter made it onto disk, the next reboot would hit the BUG_ON() in add_new_free_space(). 4. On some hosts with no on-disk corruption or error messages, the in-memory space cache (dumped with drgn) disagreed with the free space tree. All of these symptoms have the same underlying cause: a race between caching the free space for a block group and returning free space to the in-memory space cache for pinned extents causes us to double-add a free range to the space cache. This race exists when free space is cached from the free space tree (space_cache=v2) or the extent tree (nospace_cache, or space_cache=v1 if the cache needs to be regenerated). struct btrfs_block_group::last_byte_to_unpin and struct btrfs_block_group::progress are supposed to protect against this race, but commit d0c2f4fa555e ("btrfs: make concurrent fsyncs wait less when waiting for a transaction commit") subtly broke this by allowing multiple transactions to be unpinning extents at the same time. Specifically, the race is as follows: 1. An extent is deleted from an uncached block group in transaction A. 2. btrfs_commit_transaction() is called for transaction A. 3. btrfs_run_delayed_refs() -> __btrfs_free_extent() runs the delayed ref for the deleted extent. 4. __btrfs_free_extent() -> do_free_extent_accounting() -> add_to_free_space_tree() adds the deleted extent back to the free space tree. 5. do_free_extent_accounting() -> btrfs_update_block_group() -> btrfs_cache_block_group() queues up the block group to get cached. block_group->progress is set to block_group->start. 6. btrfs_commit_transaction() for transaction A calls switch_commit_roots(). It sets block_group->last_byte_to_unpin to block_group->progress, which is block_group->start because the block group hasn't been cached yet. 7. The caching thread gets to our block group. Since the commit roots were already switched, load_free_space_tree() sees the deleted extent as free and adds it to the space cache. It finishes caching and sets block_group->progress to U64_MAX. 8. btrfs_commit_transaction() advances transaction A to TRANS_STATE_SUPER_COMMITTED. 9. fsync calls btrfs_commit_transaction() for transaction B. Since transaction A is already in TRANS_STATE_SUPER_COMMITTED and the commit is for fsync, it advances. 10. btrfs_commit_transaction() for transaction B calls switch_commit_roots(). This time, the block group has already been cached, so it sets block_group->last_byte_to_unpin to U64_MAX. 11. btrfs_commit_transaction() for transaction A calls btrfs_finish_extent_commit(), which calls unpin_extent_range() for the deleted extent. It sees last_byte_to_unpin set to U64_MAX (by transaction B!), so it adds the deleted extent to the space cache again! This explains all of our symptoms above: * If the sequence of events is exactly as described above, when the free space is re-added in step 11, it will fail with EEXIST. * If another thread reallocates the deleted extent in between steps 7 and 11, then step 11 will silently re-add that space to the space cache as free even though it is actually allocated. Then, if that space is allocated *again*, the free space tree will be corrupted (namely, the wrong item will be deleted). * If we don't catch this free space tree corr ---truncated---

UnknownCVSS not scoredNot KEV-listedUpdated
Glexia's TakeAutomated analysisunknown

Security readout for executives and security teams

Plain-English summary

This Linux kernel Btrfs flaw can corrupt filesystem free-space tracking. In affected conditions, storage blocks may be treated as free and allocated twice, risking filesystem corruption or a crash on reboot. The sources do not provide CVSS severity or confirmed exploitation.

Executive priority

Treat as a storage integrity risk for Btrfs-backed Linux systems. Business urgency depends on Btrfs usage and data criticality. Patch planning is warranted, but the provided evidence does not support claims of active exploitation or remote compromise.

Technical view

The issue is a race between Btrfs block-group free-space caching and unpinning pinned extents across transactions. It can double-add ranges into the in-memory space cache, desynchronizing it from the free space tree or extent tree and causing EEXIST errors, double allocations, or BUG_ON failures.

Likely exposure

Exposure appears limited to Linux systems using Btrfs, especially where free-space caching is active or regenerated. The source lists Linux kernel versions including 5.12, 5.15.65, 5.19.6, and 6.0, but exact affected range semantics are incomplete in the provided bundle.

Exploitation context

No active exploitation is stated. The CVE is not marked KEV in the provided bundle. The described trigger is a kernel race under Btrfs transaction, fsync, delayed reference, and free-space caching behavior, not a documented remote attack path.

Researcher notes

Focus analysis on the transaction race introduced by commit d0c2f4fa555e and fixed by the referenced stable commits. The evidence supports filesystem metadata corruption and crash risk, but lacks CVSS, CWE mapping, exploit reports, and complete affected-version semantics.

Mitigation direction

  • Review Linux vendor advisories for kernels containing the referenced stable fixes.
  • Prioritize updates on systems using Btrfs for important or high-churn data.
  • Back up Btrfs filesystems before kernel remediation or filesystem repair work.
  • Monitor for Btrfs free-space errors, BUG_ON crashes, or corruption warnings.
  • Avoid inventing workarounds; follow kernel or distribution guidance.

Validation and detection

  • Inventory Linux hosts using Btrfs filesystems.
  • Check running kernel versions against vendor-patched releases.
  • Review logs for Btrfs free-space tree and EEXIST messages.
  • Confirm whether referenced stable commits are included in deployed kernels.
  • Test remediation on representative Btrfs workloads before broad rollout.
Prepared
Confidence
medium
Sources
5

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-2022-49999 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
Unknown
CVSS
Not scored
Known Exploited
No
Published
Official CVE source material

CNA and ADP enrichment extracted from CVE v5

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
4Source links

Vulnerability timeline

Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.

  1. CVE reservedCVE Program

    The CVE ID was reserved by the assigning CNA.

  2. CVE publishedCVE Program

    The CVE record was published.

  3. CVE updatedCVE Program

    The CVE record metadata indicates this as the latest update time.

Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
LinuxLinuxd0c2f4fa555e70324ec2a129b822ab58f172cc62, d0c2f4fa555e70324ec2a129b822ab58f172cc62, d0c2f4fa555e70324ec2a129b822ab58f172cc62unaffected
LinuxLinux5.12, 0, 5.15.65, 5.19.6, 6.0affected
Weakness

CWE details

No CWE listed

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.