# CVE-2023-54121: btrfs: fix incorrect splitting in btrfs\_drop\_extent\_map\_range

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

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; 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.23% (percentile 8, 2026-11-26)
- **Published:** 2025-12-24T13:06:41.185Z
- **Modified:** 2026-08-05T09:17:24.043Z

## Who should check

- Anyone running Linux \>= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, \< 9f68e2105dd96cf0fafffffafb2337fbd0fbae1f; \>= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, \< b43a4c99d878cf5e59040e45c96bb0a8358bfb3b; \>= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, \< c962098ca4af146f2625ed64399926a098752c9c; c87afd35a28b2661a2626a1b28e9fd69adcad9f9; \>= 2.6.32.19, \< 2.6.33
- Anyone running Linux 2.6.33

## Description

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

btrfs: fix incorrect splitting in btrfs\_drop\_extent\_map\_range

In production we were seeing a variety of WARN\_ON()'s in the extent\_map
code, specifically in btrfs\_drop\_extent\_map\_range() when we have to call
add\_extent\_mapping() for our second split.

Consider the following extent map layout

	PINNED
	\[0 16K)  \[32K, 48K)

and then we call btrfs\_drop\_extent\_map\_range for \[0, 36K), with
skip\_pinned == true.  The initial loop will have

	start = 0
	end = 36K
	len = 36K

we will find the \[0, 16k) extent, but since we are pinned we will skip
it, which has this code

	start = em\_end;
	if (end != (u64)-1)
		len = start + len - em\_end;

em\_end here is 16K, so now the values are

	start = 16K
	len = 16K + 36K - 16K = 36K

len should instead be 20K.  This is a problem when we find the next
extent at \[32K, 48K), we need to split this extent to leave \[36K, 48k),
however the code for the split looks like this

	split-\>start = start + len;
	split-\>len = em\_end - (start + len);

In this case we have

	em\_end = 48K
	split-\>start = 16K + 36K       // this should be 16K + 20K
	split-\>len = 48K - (16K + 36K) // this overflows as 16K + 36K is 52K

and now we have an invalid extent\_map in the tree that potentially
overlaps other entries in the extent map.  Even in the non-overlapping
case we will have split-\>start set improperly, which will cause problems
with any block related calculations.

We don't actually need len in this loop, we can simply use end as our
end point, and only adjust start up when we find a pinned extent we need
to skip.

Adjust the logic to do this, which keeps us from inserting an invalid
extent map.

We only skip\_pinned in the relocation case, so this is relatively rare,
except in the case where you are running relocation a lot, which can
happen with auto relocation on.

## Affected and fixed versions

- Linux: \>= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, \< 9f68e2105dd96cf0fafffffafb2337fbd0fbae1f; \>= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, \< b43a4c99d878cf5e59040e45c96bb0a8358bfb3b; \>= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, \< c962098ca4af146f2625ed64399926a098752c9c; c87afd35a28b2661a2626a1b28e9fd69adcad9f9; \>= 2.6.32.19, \< 2.6.33 (cvelist)
- Linux: 2.6.33 (cvelist)

## Mitigation

- Upgrade Linux to 2.6.33 or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2023-54121.md
Affected: Linux >= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, < 9f68e2105dd96cf0fafffffafb2337fbd0fbae1f; >= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, < b43a4c99d878cf5e59040e45c96bb0a8358bfb3b; >= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, < c962098ca4af146f2625ed64399926a098752c9c; c87afd35a28b2661a2626a1b28…
Fixed in: Linux 9f68e2105dd96cf0fafffffafb2337fbd0fbae1f, Linux 2.6.33

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-2023-54121 being exploited?

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

### How serious is CVE-2023-54121?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2023-54121?

Linux \>= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, \< 9f68e2105dd96cf0fafffffafb2337fbd0fbae1f; \>= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, \< b43a4c99d878cf5e59040e45c96bb0a8358bfb3b; \>= 55ef68990029fcd8d04d42fc184aa7fb18cf309e, \< c962098ca4af146f2625ed64399926a098752c9c; c87afd35a28b2661a2626a1b28e9fd69adcad9f9; \>= 2.6.32.19, \< 2.6.33; Linux 2.6.33.

### Is there a fix for CVE-2023-54121?

Yes. Fixed in Linux 9f68e2105dd96cf0fafffffafb2337fbd0fbae1f, Linux 2.6.33. Upgrade Linux to 2.6.33 or later.

### How do I check if I'm affected by CVE-2023-54121?

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

- other: <https://git.kernel.org/stable/c/9f68e2105dd96cf0fafffffafb2337fbd0fbae1f>
- other: <https://git.kernel.org/stable/c/b43a4c99d878cf5e59040e45c96bb0a8358bfb3b>
- other: <https://git.kernel.org/stable/c/c962098ca4af146f2625ed64399926a098752c9c>

## 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-2023-54121>

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