CVE-2023-54121: btrfs: fix incorrect splitting in btrfs_drop_extent_map_range

Published Dec 24, 2025
·
Updated

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

btrfs: fix incorrect splitting in btrfsdropextentmaprange

In production we were seeing a variety of WARNON()'s in the extentmap code, specifically in btrfsdropextentmaprange() when we have to call addextentmapping() for our second split.

Consider the following extent map layout

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

and then we call btrfsdropextentmaprange for [0, 36K), with skippinned == 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 = emend; if (end != (u64)-1) len = start + len - emend;

emend 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 = emend - (start + len);

In this case we have

emend = 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 extentmap 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 skippinned 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 Software

1 affected component
linux-kernel

Event History

Dec 24, 2025
CVE Published
via MITRE·01:06 PM
Data Sourced
via MITRE·01:06 PM
DescriptionSeverity
Data Sourced
via NVD·01:16 PM
DescriptionSeverity
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2023-54121?

CVE-2023-54121 is classified as a medium severity vulnerability in the Linux kernel.

2

How do I fix CVE-2023-54121?

To mitigate CVE-2023-54121, it is recommended to update to the latest version of the Linux kernel where the vulnerability has been patched.

3

What does CVE-2023-54121 affect?

CVE-2023-54121 affects the btrfs filesystem within the Linux kernel.

4

What are the potential consequences of exploiting CVE-2023-54121?

Exploitation of CVE-2023-54121 can lead to system instability and potential data corruption.

5

When was CVE-2023-54121 disclosed?

CVE-2023-54121 was disclosed in the latter part of 2023 as part of security updates for the Linux kernel.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203