CVE-2021-47508: btrfs: free exchange changeset on failures
In the Linux kernel, the following vulnerability has been resolved:
btrfs: free exchange changeset on failures
Fstests runs on my VMs have show several kmemleak reports like the following.
unreferenced object 0xffff88811ae59080 (size 64):
comm "xfs_io", pid 12124, jiffies 4294987392 (age 6.368s)
hex dump (first 32 bytes):
00 c0 1c 00 00 00 00 00 ff cf 1c 00 00 00 00 00 ................
90 97 e5 1a 81 88 ff ff 90 97 e5 1a 81 88 ff ff ................
backtrace:
[<00000000ac0176d2>] ulist_add_merge+0x60/0x150 [btrfs]
[<0000000076e9f312>] set_state_bits+0x86/0xc0 [btrfs]
[<0000000014fe73d6>] set_extent_bit+0x270/0x690 [btrfs]
[<000000004f675208>] set_record_extent_bits+0x19/0x20 [btrfs]
[<00000000b96137b1>] qgroup_reserve_data+0x274/0x310 [btrfs]
[<0000000057e9dcbb>] btrfs_check_data_free_space+0x5c/0xa0 [btrfs]
[<0000000019c4511d>] btrfs_delalloc_reserve_space+0x1b/0xa0 [btrfs]
[<000000006d37e007>] btrfs_dio_iomap_begin+0x415/0x970 [btrfs]
[<00000000fb8a74b8>] iomap_iter+0x161/0x1e0
[<0000000071dff6ff>] __iomap_dio_rw+0x1df/0x700
[<000000002567ba53>] iomap_dio_rw+0x5/0x20
[<0000000072e555f8>] btrfs_file_write_iter+0x290/0x530 [btrfs]
[<000000005eb3d845>] new_sync_write+0x106/0x180
[<000000003fb505bf>] vfs_write+0x24d/0x2f0
[<000000009bb57d37>] __x64_sys_pwrite64+0x69/0xa0
[<000000003eba3fdf>] do_syscall_64+0x43/0x90
In case brtfs_qgroup_reserve_data() or btrfs_delalloc_reserve_metadata()
fail the allocated extent_changeset will not be freed.
So in btrfs_check_data_free_space() and btrfs_delalloc_reserve_space()
free the allocated extent_changeset to get rid of the allocated memory.
The issue currently only happens in the direct IO write path, but only
after 65b3c08606e5 ("btrfs: fix ENOSPC failure when attempting direct IO
write into NOCOW range"), and also at defrag_one_locked_target(). Every
other place is always calling extent_changeset_free() even if its call
to btrfs_delalloc_reserve_space() or btrfs_check_data_free_space() has
failed.
Security readout for executives and security teams
Plain-English summary
This Linux kernel issue is a Btrfs memory leak on certain failure paths. Under specific write or defragmentation conditions, allocated memory may not be released. The sources do not show remote exploitation, active exploitation, CVSS scoring, or confirmed business impact beyond kernel memory leakage.
Executive priority
Treat this as routine kernel hygiene unless Btrfs is heavily used on memory-constrained or high-availability systems. There is no source-backed evidence of active exploitation, but patching remains appropriate because kernel memory leaks can degrade reliability.
Technical view
Btrfs fails to free an allocated extent_changeset when btrfs_qgroup_reserve_data() or btrfs_delalloc_reserve_metadata() fails. The report ties this mainly to the direct I/O write path after commit 65b3c08606e5 and to defrag_one_locked_target(). Stable kernel fixes free the changeset on those failure paths.
Likely exposure
Exposure appears limited to systems running affected Linux kernels with Btrfs in use, especially workloads exercising direct I/O write paths or Btrfs defragmentation. Downstream distribution exposure depends on kernel backports and vendor packaging.
Exploitation context
The provided sources do not claim active exploitation, and CISA KEV status is false. The evidence describes kmemleak findings during filesystem testing, not a public exploit or remote attack path.
Researcher notes
The record lacks CVSS, CWE, and detailed exploitability analysis. The strongest source evidence is the kernel commit narrative: missing extent_changeset_free() calls on specific Btrfs allocation-failure paths. Validate against exact downstream kernel trees, not version strings alone.
Mitigation direction
Identify systems using Btrfs on Linux kernels matching the affected CVE metadata.
Prioritize kernel updates from the operating system or distribution vendor.
Verify whether vendor kernels include the referenced stable fixes or backports.
Avoid inventing workarounds; follow vendor guidance if patching is delayed.
Validation and detection
Inventory Linux kernel versions and confirm whether Btrfs filesystems are mounted.
Check distribution advisories for CVE-2021-47508 backport status.
Confirm patched kernels include the referenced stable commits or equivalent fixes.
Review kernel logs and memory-leak diagnostics for repeated Btrfs kmemleak reports.
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-2021-47508 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.