Skip to content
Heist/ feed
Back to feed
UnratedFix available

btrfs: do not BUG_ON() on ENOMEM when dropping extent items for a range

Type: advisorySources: OSV

In the Linux kernel, the following vulnerability has been resolved: btrfs: do not BUG_ON() on ENOMEM when dropping extent items for a range If we get -ENOMEM while dropping file extent items in a given range, at btrfs_drop_extents(), due to failure to allocate memory when attempting to increment the reference count for an extent or drop the reference count, we handle it with a BUG_ON(). This is excessive, instead we can simply abort the transaction and return the error to the caller. In fact most callers of btrfs_drop_extents(), directly or indirectly, already abort the transaction if btrfs_drop_extents() returns any error. Also, we already have error paths at btrfs_drop_extents() that may return -ENOMEM and in those cases we abort the transaction, like for example anything that changes the b+tree may return -ENOMEM due to a failure to allocate a new extent buffer when COWing an existing extent buffer, such as a call to btrfs_duplicate_item() for example. So replace the BUG_ON() calls with proper logic to abort the transaction and return the error.

Products
Kernel
Affected versions
Not specified
Fixed versions
5.15.86, 6.0.16, 6.1.2
CVEs
CVE-2022-50293
Confirmed fixed CVEs
Not specified
Updated in this feed
7 Nov 2026, 02:15 UTC · Revision 1

Source evidence

btrfs: do not BUG_ON() on ENOMEM when dropping extent items for a range

core-osv · Original source

Published 15 Sept 2025, 14:45 UTC

In the Linux kernel, the following vulnerability has been resolved: btrfs: do not BUG_ON() on ENOMEM when dropping extent items for a range If we get -ENOMEM while dropping file extent items in a given range, at btrfs_drop_extents(), due to failure to allocate memory when attempting to increment the reference count for an extent or drop the reference count, we handle it with a BUG_ON(). This is excessive, instead we can simply abort the transaction and return the error to the caller. In fact most callers of btrfs_drop_extents(), directly or indirectly, already abort the transaction if btrfs_drop_extents() returns any error. Also, we already have error paths at btrfs_drop_extents() that may return -ENOMEM and in those cases we abort the transaction, like for example anything that changes the b+tree may return -ENOMEM due to a failure to allocate a new extent buffer when COWing an existing extent buffer, such as a call to btrfs_duplicate_item() for example. So replace the BUG_ON() calls with proper logic to abort the transaction and return the error.

osv:CVE-2022-50293

Kernel

Fixed versions: 5.15.86, 6.0.16, 6.1.2

Complete source record
{
  "id": "2c94356a4bb25003adda0117b78fc22a2eacc0fb402c61fc0f73b407b59368b1",
  "url": "https://osv.dev/vulnerability/CVE-2022-50293",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "btrfs: do not BUG_ON() on ENOMEM when dropping extent items for a range",
    "summary": "In the Linux kernel, the following vulnerability has been resolved: btrfs: do not BUG_ON() on ENOMEM when dropping extent items for a range If we get -ENOMEM while dropping file extent items in a given range, at btrfs_drop_extents(), due to failure to allocate memory when attempting to increment the reference count for an extent or drop the reference count, we handle it with a BUG_ON(). This is excessive, instead we can simply abort the transaction and return the error to the caller. In fact most callers of btrfs_drop_extents(), directly or indirectly, already abort the transaction if btrfs_drop_extents() returns any error. Also, we already have error paths at btrfs_drop_extents() that may return -ENOMEM and in those cases we abort the transaction, like for example anything that changes the b+tree may return -ENOMEM due to a failure to allocate a new extent buffer when COWing an existing extent buffer, such as a call to btrfs_duplicate_item() for example. So replace the BUG_ON() calls with proper logic to abort the transaction and return the error.",
    "evidence": "osv:CVE-2022-50293",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "5.15.86",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.0.16",
            "evidence": "/affected/1/ranges"
          },
          {
            "value": "6.1.2",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "CVE-2022-50293",
      "aliases": [
        "CVE-2022-50293"
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "39279cc3d2704cfbf9c35dcb5bdd392159ae4625"
                },
                {
                  "fixed": "50f993da945074b2a069da099a0331b23a0c89a0"
                },
                {
                  "fixed": "7fbcb635c8fc927d139f3302babcf1b42c09265c"
                },
                {
                  "fixed": "1baf3370e2dc5e6bd1368348736189457dab2a27"
                },
                {
                  "fixed": "162d053e15fe985f754ef495a96eb3db970c43ed"
                }
              ]
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50293.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "2.6.29"
                },
                {
                  "fixed": "5.15.86"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.16.0"
                },
                {
                  "fixed": "6.0.16"
                }
              ]
            },
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.1.0"
                },
                {
                  "fixed": "6.1.2"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50293.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:49.174913856Z",
      "provider": "osv",
      "references": [
        "https://git.kernel.org/stable/c/162d053e15fe985f754ef495a96eb3db970c43ed",
        "https://git.kernel.org/stable/c/1baf3370e2dc5e6bd1368348736189457dab2a27",
        "https://git.kernel.org/stable/c/50f993da945074b2a069da099a0331b23a0c89a0",
        "https://git.kernel.org/stable/c/7fbcb635c8fc927d139f3302babcf1b42c09265c",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50293.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-50293",
        "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
      ],
      "provider_metadata": {
        "cna_assigner": "Linux",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50293.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-50293",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 517286,
  "published_at": "2025-09-15T14:45:49.338+00:00"
}