btrfs: do not BUG_ON() on ENOMEM when dropping extent items for a range
Published Sep 15, 2025
5.5
MEDIUMCVSS 3.1
EPSS 0.16%
Description
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.
Affected products
-
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version
-
- Version 2.6.29StatusaffectedConstraints-
- Version 0StatusunaffectedConstraints<2.6.29
- Version 5.15.86StatusunaffectedConstraints<=5.15.*
- Version 6.0.16StatusunaffectedConstraints<=6.0.*
- Version 6.1.2StatusunaffectedConstraints<=6.1.*
- Version 6.2StatusunaffectedConstraints<=*
- Version
Default status is the baseline for the product, each version can override it (e.g. patched versions marked unaffected).
- < 5.15.86
- ≥ 5.16 · < 6.0.16
- ≥ 6.1 · < 6.1.2
No data.
Red Hat Enterprise Linux 10
kernel
Not affected
Red Hat Enterprise Linux 6
kernel
Out of support scope
Red Hat Enterprise Linux 7
kernel
Fix deferred
Red Hat Enterprise Linux 7
kernel-rt
Fix deferred
Red Hat Enterprise Linux 8
kernel
Not affected
Red Hat Enterprise Linux 8
kernel-rt
Not affected
Red Hat Enterprise Linux 9
kernel
Not affected
Red Hat Enterprise Linux 9
kernel-rt
Not affected
| Product | Package | State | Advisory |
|---|---|---|---|
| Red Hat Enterprise Linux 10 | kernel | Not affected | n/a |
| Red Hat Enterprise Linux 6 | kernel | Out of support scope | n/a |
| Red Hat Enterprise Linux 7 | kernel | Fix deferred | n/a |
| Red Hat Enterprise Linux 7 | kernel-rt | Fix deferred | n/a |
| Red Hat Enterprise Linux 8 | kernel | Not affected | n/a |
| Red Hat Enterprise Linux 8 | kernel-rt | Not affected | n/a |
| Red Hat Enterprise Linux 9 | kernel | Not affected | n/a |
| Red Hat Enterprise Linux 9 | kernel-rt | Not affected | n/a |
No package ranges for this CVE.
Remediation
No remediation recorded yet.
References (10)
- https://access.redhat.com/security/cve/CVE-2022-50293 Vendor Advisory
- https://bugzilla.redhat.com/show_bug.cgi?id=2395347 Issue Tracking
- https://euvd.enisa.europa.eu/vulnerability/EUVD-2022-55562 Advisory
- https://git.kernel.org/stable/c/162d053e15fe985f754ef495a96eb3db970c43ed Patch
- https://git.kernel.org/stable/c/1baf3370e2dc5e6bd1368348736189457dab2a27 Patch
- https://git.kernel.org/stable/c/50f993da945074b2a069da099a0331b23a0c89a0 Patch
- https://git.kernel.org/stable/c/7fbcb635c8fc927d139f3302babcf1b42c09265c Patch
- https://lore.kernel.org/linux-cve-announce/2025091556-CVE-2022-50293-2dbe@gregkh/T
- https://nvd.nist.gov/vuln/detail/CVE-2022-50293
- https://www.cve.org/CVERecord?id=CVE-2022-50293
Change history (0)
No recorded changes yet.