# CVE-2024-26726: btrfs: don't drop extent\_map for free space inode on write error

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.35% (percentile 21, 2026-11-26)
- **CWE:** CWE-617
- **Published:** 2024-04-03T14:55:24.983Z
- **Modified:** 2026-06-17T07:18:11.230Z

## Who should check

- Anyone running Linux \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 143842584c1237ebc248b2547c29d16bbe400a92; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 02f2b95b00bf57d20320ee168b30fb7f3db8e555; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 7bddf18f474f166c19f91b2baf67bf7c5eda03f7; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< a4b7741c8302e28073bfc6dd1c2e73598e5e535e; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 5571e41ec6e56e35f34ae9f5b3a335ef510e0ade
- Anyone running Linux 3.12

## Description

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

btrfs: don't drop extent\_map for free space inode on write error

While running the CI for an unrelated change I hit the following panic
with generic/648 on btrfs\_holes\_spacecache.

assertion failed: block\_start != EXTENT\_MAP\_HOLE, in fs/btrfs/extent\_io.c:1385
------------\[ cut here \]------------
kernel BUG at fs/btrfs/extent\_io.c:1385!
invalid opcode: 0000 \[\#1\] PREEMPT SMP NOPTI
CPU: 1 PID: 2695096 Comm: fsstress Kdump: loaded Tainted: G        W          6.8.0-rc2+ \#1
RIP: 0010:\_\_extent\_writepage\_io.constprop.0+0x4c1/0x5c0
Call Trace:
 \<TASK\>
 extent\_write\_cache\_pages+0x2ac/0x8f0
 extent\_writepages+0x87/0x110
 do\_writepages+0xd5/0x1f0
 filemap\_fdatawrite\_wbc+0x63/0x90
 \_\_filemap\_fdatawrite\_range+0x5c/0x80
 btrfs\_fdatawrite\_range+0x1f/0x50
 btrfs\_write\_out\_cache+0x507/0x560
 btrfs\_write\_dirty\_block\_groups+0x32a/0x420
 commit\_cowonly\_roots+0x21b/0x290
 btrfs\_commit\_transaction+0x813/0x1360
 btrfs\_sync\_file+0x51a/0x640
 \_\_x64\_sys\_fdatasync+0x52/0x90
 do\_syscall\_64+0x9c/0x190
 entry\_SYSCALL\_64\_after\_hwframe+0x6e/0x76

This happens because we fail to write out the free space cache in one
instance, come back around and attempt to write it again.  However on
the second pass through we go to call btrfs\_get\_extent() on the inode to
get the extent mapping.  Because this is a new block group, and with the
free space inode we always search the commit root to avoid deadlocking
with the tree, we find nothing and return a EXTENT\_MAP\_HOLE for the
requested range.

This happens because the first time we try to write the space cache out
we hit an error, and on an error we drop the extent mapping.  This is
normal for normal files, but the free space cache inode is special.  We
always expect the extent map to be correct.  Thus the second time
through we end up with a bogus extent map.

Since we're deprecating this feature, the most straightforward way to
fix this is to simply skip dropping the extent map range for this failed
range.

I shortened the test by using error injection to stress the area to make
it easier to reproduce.  With this patch in place we no longer panic
with my error injection test.

## Affected and fixed versions

- Linux: \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 143842584c1237ebc248b2547c29d16bbe400a92; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 02f2b95b00bf57d20320ee168b30fb7f3db8e555; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 7bddf18f474f166c19f91b2baf67bf7c5eda03f7; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< a4b7741c8302e28073bfc6dd1c2e73598e5e535e; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 5571e41ec6e56e35f34ae9f5b3a335ef510e0ade (cvelist)
- Linux: 3.12 (cvelist)

## Mitigation

- Upgrade Linux to 5571e41ec6e56e35f34ae9f5b3a335ef510e0ade or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-26726. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-26726.md
Affected: Linux >= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, < 143842584c1237ebc248b2547c29d16bbe400a92; >= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, < 02f2b95b00bf57d20320ee168b30fb7f3db8e555; >= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, < 7bddf18f474f166c19f91b2baf67bf7c5eda03f7; >= 77cef2ec5484564eca6bd12…
Fixed in: Linux 143842584c1237ebc248b2547c29d16bbe400a92, Linux 02f2b95b00bf57d20320ee168b30fb7f3db8e555, Linux 7bddf18f474f166c19f91b2baf67bf7c5eda03f7, Linux 5571e41ec6e56e35f34ae9f5b3a335ef510e0ade

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-26726 being exploited?

There is no confirmed exploitation: CVE-2024-26726 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.35% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-26726?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-26726?

Linux \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 143842584c1237ebc248b2547c29d16bbe400a92; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 02f2b95b00bf57d20320ee168b30fb7f3db8e555; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 7bddf18f474f166c19f91b2baf67bf7c5eda03f7; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< a4b7741c8302e28073bfc6dd1c2e73598e5e535e; \>= 77cef2ec5484564eca6bd12a2b4a1e88fd766fbc, \< 5571e41ec6e56e35f34ae9f5b3a335ef510e0ade; Linux 3.12.

### Is there a fix for CVE-2024-26726?

Yes. Fixed in Linux 143842584c1237ebc248b2547c29d16bbe400a92, Linux 02f2b95b00bf57d20320ee168b30fb7f3db8e555, Linux 7bddf18f474f166c19f91b2baf67bf7c5eda03f7, Linux 5571e41ec6e56e35f34ae9f5b3a335ef510e0ade. Upgrade Linux to 5571e41ec6e56e35f34ae9f5b3a335ef510e0ade or later.

### How do I check if I'm affected by CVE-2024-26726?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/02f2b95b00bf57d20320ee168b30fb7f3db8e555>
- patch: <https://git.kernel.org/stable/c/7bddf18f474f166c19f91b2baf67bf7c5eda03f7>
- patch: <https://git.kernel.org/stable/c/a4b7741c8302e28073bfc6dd1c2e73598e5e535e>
- patch: <https://git.kernel.org/stable/c/5571e41ec6e56e35f34ae9f5b3a335ef510e0ade>
- other: <https://git.kernel.org/stable/c/143842584c1237ebc248b2547c29d16bbe400a92>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-26726>

HTML: <https://flawdb.com/CVE-2024-26726> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-26726>
