{"id":"DEBIAN-CVE-2023-54121","details":"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  \tPINNED \t[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  \tstart = 0 \tend = 36K \tlen = 36K  we will find the [0, 16k) extent, but since we are pinned we will skip it, which has this code  \tstart = em_end; \tif (end != (u64)-1) \t\tlen = start + len - em_end;  em_end here is 16K, so now the values are  \tstart = 16K \tlen = 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  \tsplit-\u003estart = start + len; \tsplit-\u003elen = em_end - (start + len);  In this case we have  \tem_end = 48K \tsplit-\u003estart = 16K + 36K       // this should be 16K + 20K \tsplit-\u003elen = 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-\u003estart 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.","modified":"2026-09-15T09:02:52.954350763Z","published":"2025-12-24T13:16:14.043Z","upstream":["CVE-2023-54121"],"references":[{"type":"ADVISORY","url":"https://security-tracker.debian.org/tracker/CVE-2023-54121"}],"affected":[{"package":{"name":"linux","ecosystem":"Debian:12","purl":"pkg:deb/debian/linux?arch=source&distro=bookworm"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.1.52-1"}]}],"versions":["6.1.27-1","6.1.37-1","6.1.38-1","6.1.38-2","6.1.38-2~bpo11+1","6.1.38-3","6.1.38-4","6.1.38-4~bpo11+1"],"ecosystem_specific":{"urgency":"not yet assigned"},"database_specific":{"source":"https://storage.googleapis.com/osv-test-debian-osv/debian-cve-osv/DEBIAN-CVE-2023-54121.json"}},{"package":{"name":"linux","ecosystem":"Debian:13","purl":"pkg:deb/debian/linux?arch=source&distro=trixie"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.4.13-1"}]}],"ecosystem_specific":{"urgency":"not yet assigned"},"database_specific":{"source":"https://storage.googleapis.com/osv-test-debian-osv/debian-cve-osv/DEBIAN-CVE-2023-54121.json"}},{"package":{"name":"linux","ecosystem":"Debian:14","purl":"pkg:deb/debian/linux?arch=source&distro=forky"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.4.13-1"}]}],"ecosystem_specific":{"urgency":"not yet assigned"},"database_specific":{"source":"https://storage.googleapis.com/osv-test-debian-osv/debian-cve-osv/DEBIAN-CVE-2023-54121.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"}]}