CVE-2023-54121 (GCVE-0-2023-54121)

Vulnerability from cvelistv5 – Published: 2025-12-24 13:06 – Updated: 2026-08-05 09:17
VLAI
Title
btrfs: fix incorrect splitting in btrfs_drop_extent_map_range
Summary
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.
Assigner
Impacted products
Vendor Product Version
Linux Linux Affected: 55ef68990029fcd8d04d42fc184aa7fb18cf309e , < 9f68e2105dd96cf0fafffffafb2337fbd0fbae1f (git)
Affected: 55ef68990029fcd8d04d42fc184aa7fb18cf309e , < b43a4c99d878cf5e59040e45c96bb0a8358bfb3b (git)
Affected: 55ef68990029fcd8d04d42fc184aa7fb18cf309e , < c962098ca4af146f2625ed64399926a098752c9c (git)
Affected: c87afd35a28b2661a2626a1b28e9fd69adcad9f9 (git)
Affected: 2.6.32.19 , < 2.6.33 (semver)
Create a notification for this product.
Linux Linux Affected: 2.6.33
Unaffected: 0 , < 2.6.33 (semver)
Unaffected: 6.1.47 , ≤ 6.1.* (semver)
Unaffected: 6.4.12 , ≤ 6.4.* (semver)
Unaffected: 6.5 , ≤ * (original_commit_for_fix)
Create a notification for this product.
Show details on NVD website

{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "fs/btrfs/extent_map.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "9f68e2105dd96cf0fafffffafb2337fbd0fbae1f",
              "status": "affected",
              "version": "55ef68990029fcd8d04d42fc184aa7fb18cf309e",
              "versionType": "git"
            },
            {
              "lessThan": "b43a4c99d878cf5e59040e45c96bb0a8358bfb3b",
              "status": "affected",
              "version": "55ef68990029fcd8d04d42fc184aa7fb18cf309e",
              "versionType": "git"
            },
            {
              "lessThan": "c962098ca4af146f2625ed64399926a098752c9c",
              "status": "affected",
              "version": "55ef68990029fcd8d04d42fc184aa7fb18cf309e",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "c87afd35a28b2661a2626a1b28e9fd69adcad9f9",
              "versionType": "git"
            },
            {
              "lessThan": "2.6.33",
              "status": "affected",
              "version": "2.6.32.19",
              "versionType": "semver"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "fs/btrfs/extent_map.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "2.6.33"
            },
            {
              "lessThan": "2.6.33",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.47",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.4.*",
              "status": "unaffected",
              "version": "6.4.12",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.5",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.1.47",
                  "versionStartIncluding": "2.6.33",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.4.12",
                  "versionStartIncluding": "2.6.33",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.5",
                  "versionStartIncluding": "2.6.33",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionStartIncluding": "2.6.32.19",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix incorrect splitting in btrfs_drop_extent_map_range\n\nIn production we were seeing a variety of WARN_ON()\u0027s in the extent_map\ncode, specifically in btrfs_drop_extent_map_range() when we have to call\nadd_extent_mapping() for our second split.\n\nConsider the following extent map layout\n\n\tPINNED\n\t[0 16K)  [32K, 48K)\n\nand then we call btrfs_drop_extent_map_range for [0, 36K), with\nskip_pinned == true.  The initial loop will have\n\n\tstart = 0\n\tend = 36K\n\tlen = 36K\n\nwe will find the [0, 16k) extent, but since we are pinned we will skip\nit, which has this code\n\n\tstart = em_end;\n\tif (end != (u64)-1)\n\t\tlen = start + len - em_end;\n\nem_end here is 16K, so now the values are\n\n\tstart = 16K\n\tlen = 16K + 36K - 16K = 36K\n\nlen should instead be 20K.  This is a problem when we find the next\nextent at [32K, 48K), we need to split this extent to leave [36K, 48k),\nhowever the code for the split looks like this\n\n\tsplit-\u003estart = start + len;\n\tsplit-\u003elen = em_end - (start + len);\n\nIn this case we have\n\n\tem_end = 48K\n\tsplit-\u003estart = 16K + 36K       // this should be 16K + 20K\n\tsplit-\u003elen = 48K - (16K + 36K) // this overflows as 16K + 36K is 52K\n\nand now we have an invalid extent_map in the tree that potentially\noverlaps other entries in the extent map.  Even in the non-overlapping\ncase we will have split-\u003estart set improperly, which will cause problems\nwith any block related calculations.\n\nWe don\u0027t actually need len in this loop, we can simply use end as our\nend point, and only adjust start up when we find a pinned extent we need\nto skip.\n\nAdjust the logic to do this, which keeps us from inserting an invalid\nextent map.\n\nWe only skip_pinned in the relocation case, so this is relatively rare,\nexcept in the case where you are running relocation a lot, which can\nhappen with auto relocation on."
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "baseScore": 7.8,
            "baseSeverity": "HIGH",
            "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
            "version": "3.1"
          },
          "scenarios": [
            {
              "lang": "en",
              "value": "AV:L - The bug is triggered through local filesystem operations on a mounted btrfs \u2014 ordinary writes creating pinned extent maps combined with the in-kernel relocation path. No network or remote peer data is involved.\nAC:L - The attacker fully controls the extent-map layout side (writes create EXTENT_FLAG_PINNED maps via create_io_em(), and file layout/extent sizes are attacker-chosen) and can maintain it continuously; relocation recurs automatically on zoned btrfs (bg_reclaim_threshold=75 by default, drivable by filling then deleting data) and via routine distro balance timers, so no condition is genuinely outside attacker influence.\nPR:L - The attacker\u0027s side of the trigger requires only an unprivileged local account with write access to a btrfs filesystem \u2014 plain write(2)/fallocate paths with no capability check reach create_io_em() and the extent map tree. No CAP_SYS_ADMIN is needed on the attacker\u0027s own path.\nUI:N - No victim action is required \u2014 automatic block-group reclaim and scheduled relocation run as background kernel work, and the corrupting split happens without any interactive step by another user.\nS:U - The corruption is confined to the kernel\u0027s own extent map tree and the filesystem it manages; no VM, IOMMU, or sandbox security boundary is crossed.\nC:H - The inserted extent map carries a wrong block_start (off by the skipped pinned extent\u0027s size) and an underflowed length, and the resulting extent_offset underflow in btrfs_do_readpage() makes disk_bytenr point at attacker-influenced wrong logical addresses, pulling other files\u0027 on-disk data into the attacker\u0027s page cache.\nI:H - The same bogus block_start/block_len feed the writeback and direct-I/O paths, so data can be written to disk locations belonging to other files, and the em rbtree ordering invariant is violated (extent_map_end wraps below start), propagating further corruption through merge_extent_mapping().\nA:H - Production-observed WARN_ON()s in add_extent_mapping(), ASSERT(ret == 0) which is a BUG() with CONFIG_BTRFS_ASSERT, u64 length underflow to ~2^64, and inconsistent extent map trees leading to transaction abort and forced read-only remount or panic on panic_on_warn systems."
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-08-05T09:17:24.043Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/9f68e2105dd96cf0fafffffafb2337fbd0fbae1f"
        },
        {
          "url": "https://git.kernel.org/stable/c/b43a4c99d878cf5e59040e45c96bb0a8358bfb3b"
        },
        {
          "url": "https://git.kernel.org/stable/c/c962098ca4af146f2625ed64399926a098752c9c"
        }
      ],
      "title": "btrfs: fix incorrect splitting in btrfs_drop_extent_map_range",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2023-54121",
    "datePublished": "2025-12-24T13:06:41.185Z",
    "dateReserved": "2025-12-24T13:02:52.520Z",
    "dateUpdated": "2026-08-05T09:17:24.043Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "epss": {
      "cve": "CVE-2023-54121",
      "date": "2026-08-06",
      "epss": "0.00142",
      "percentile": "0.03949"
    },
    "nvd": "{\"cve\":{\"id\":\"CVE-2023-54121\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2025-12-24T13:16:14.043\",\"lastModified\":\"2026-08-04T10:19:29.903\",\"vulnStatus\":\"Deferred\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nbtrfs: fix incorrect splitting in btrfs_drop_extent_map_range\\n\\nIn production we were seeing a variety of WARN_ON()\u0027s in the extent_map\\ncode, specifically in btrfs_drop_extent_map_range() when we have to call\\nadd_extent_mapping() for our second split.\\n\\nConsider the following extent map layout\\n\\n\\tPINNED\\n\\t[0 16K)  [32K, 48K)\\n\\nand then we call btrfs_drop_extent_map_range for [0, 36K), with\\nskip_pinned == true.  The initial loop will have\\n\\n\\tstart = 0\\n\\tend = 36K\\n\\tlen = 36K\\n\\nwe will find the [0, 16k) extent, but since we are pinned we will skip\\nit, which has this code\\n\\n\\tstart = em_end;\\n\\tif (end != (u64)-1)\\n\\t\\tlen = start + len - em_end;\\n\\nem_end here is 16K, so now the values are\\n\\n\\tstart = 16K\\n\\tlen = 16K + 36K - 16K = 36K\\n\\nlen should instead be 20K.  This is a problem when we find the next\\nextent at [32K, 48K), we need to split this extent to leave [36K, 48k),\\nhowever the code for the split looks like this\\n\\n\\tsplit-\u003estart = start + len;\\n\\tsplit-\u003elen = em_end - (start + len);\\n\\nIn this case we have\\n\\n\\tem_end = 48K\\n\\tsplit-\u003estart = 16K + 36K       // this should be 16K + 20K\\n\\tsplit-\u003elen = 48K - (16K + 36K) // this overflows as 16K + 36K is 52K\\n\\nand now we have an invalid extent_map in the tree that potentially\\noverlaps other entries in the extent map.  Even in the non-overlapping\\ncase we will have split-\u003estart set improperly, which will cause problems\\nwith any block related calculations.\\n\\nWe don\u0027t actually need len in this loop, we can simply use end as our\\nend point, and only adjust start up when we find a pinned extent we need\\nto skip.\\n\\nAdjust the logic to do this, which keeps us from inserting an invalid\\nextent map.\\n\\nWe only skip_pinned in the relocation case, so this is relatively rare,\\nexcept in the case where you are running relocation a lot, which can\\nhappen with auto relocation on.\"}],\"affected\":[{\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"affectedData\":[{\"vendor\":\"Linux\",\"product\":\"Linux\",\"defaultStatus\":\"unaffected\",\"programFiles\":[\"fs/btrfs/extent_map.c\"],\"repo\":\"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\",\"versions\":[{\"version\":\"55ef68990029fcd8d04d42fc184aa7fb18cf309e\",\"lessThan\":\"9f68e2105dd96cf0fafffffafb2337fbd0fbae1f\",\"versionType\":\"git\",\"status\":\"affected\"},{\"version\":\"55ef68990029fcd8d04d42fc184aa7fb18cf309e\",\"lessThan\":\"b43a4c99d878cf5e59040e45c96bb0a8358bfb3b\",\"versionType\":\"git\",\"status\":\"affected\"},{\"version\":\"55ef68990029fcd8d04d42fc184aa7fb18cf309e\",\"lessThan\":\"c962098ca4af146f2625ed64399926a098752c9c\",\"versionType\":\"git\",\"status\":\"affected\"},{\"version\":\"c87afd35a28b2661a2626a1b28e9fd69adcad9f9\",\"versionType\":\"git\",\"status\":\"affected\"},{\"version\":\"2.6.32.19\",\"lessThan\":\"2.6.33\",\"versionType\":\"semver\",\"status\":\"affected\"}]},{\"vendor\":\"Linux\",\"product\":\"Linux\",\"defaultStatus\":\"affected\",\"programFiles\":[\"fs/btrfs/extent_map.c\"],\"repo\":\"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git\",\"versions\":[{\"version\":\"2.6.33\",\"status\":\"affected\"},{\"version\":\"0\",\"lessThan\":\"2.6.33\",\"versionType\":\"semver\",\"status\":\"unaffected\"},{\"version\":\"6.1.47\",\"lessThanOrEqual\":\"6.1.*\",\"versionType\":\"semver\",\"status\":\"unaffected\"},{\"version\":\"6.4.12\",\"lessThanOrEqual\":\"6.4.*\",\"versionType\":\"semver\",\"status\":\"unaffected\"},{\"version\":\"6.5\",\"lessThanOrEqual\":\"*\",\"versionType\":\"original_commit_for_fix\",\"status\":\"unaffected\"}]}]}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"type\":\"Secondary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H\",\"baseScore\":7.8,\"baseSeverity\":\"HIGH\",\"attackVector\":\"LOCAL\",\"attackComplexity\":\"LOW\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"HIGH\",\"integrityImpact\":\"HIGH\",\"availabilityImpact\":\"HIGH\"},\"exploitabilityScore\":1.8,\"impactScore\":5.9}]},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/9f68e2105dd96cf0fafffffafb2337fbd0fbae1f\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/b43a4c99d878cf5e59040e45c96bb0a8358bfb3b\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/c962098ca4af146f2625ed64399926a098752c9c\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}",
    "redhat_vex": {
      "aggregate_severity": "Low",
      "current_release_date": "2026-08-04T22:52:46+00:00",
      "cve": "CVE-2023-54121",
      "id": "CVE-2023-54121",
      "initial_release_date": "2023-01-01T00:00:00+00:00",
      "product_status:known_affected": "42",
      "product_status:known_not_affected": "232",
      "source": "Red Hat CSAF VEX",
      "status": "final",
      "title": "kernel: btrfs: fix incorrect splitting in btrfs_drop_extent_map_range",
      "url": "https://security.access.redhat.com/data/csaf/v2/vex/2023/cve-2023-54121.json",
      "version": "3"
    },
    "suse_vex": {
      "aggregate_severity": "moderate",
      "current_release_date": "2026-07-25T02:07:11Z",
      "cve": "CVE-2023-54121",
      "id": "CVE-2023-54121",
      "initial_release_date": "2025-12-25T00:55:09Z",
      "product_status:known_affected": "628",
      "product_status:known_not_affected": "77",
      "product_status:recommended": "267",
      "source": "SUSE CSAF VEX",
      "status": "interim",
      "title": "SUSE CVE CVE-2023-54121",
      "url": "https://ftp.suse.com/pub/projects/security/csaf-vex/cve-2023-54121.json",
      "version": "30"
    }
  }
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…

Loading…