CVE-2022-50457: mtd: core: Fix refcount error in del_mtd_device()
In the Linux kernel, the following vulnerability has been resolved:
mtd: core: Fix refcount error in del_mtd_device()
del_mtd_device() will call of_node_put() to mtd_get_of_node(mtd), which
is mtd->dev.of_node. However, memset(&mtd->dev, 0) is called before
of_node_put(). As the result, of_node_put() won't do anything in
del_mtd_device(), and causes the refcount leak.
del_mtd_device()
memset(&mtd->dev, 0, sizeof(mtd->dev) # clear mtd->dev
of_node_put()
mtd_get_of_node(mtd) # mtd->dev is cleared, can't locate of_node
# of_node_put(NULL) won't do anything
Fix the error by caching the pointer of the device_node.
OF: ERROR: memory leak, expected refcount 1 instead of 2,
of_node_get()/of_node_put() unbalanced - destroy cset entry: attach
overlay node /spi/spi-sram@0
CPU: 3 PID: 275 Comm: python3 Tainted: G N 6.1.0-rc3+ #54
0d8a1edddf51f172ff5226989a7565c6313b08e2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x67/0x83
kobject_get+0x155/0x160
of_node_get+0x1f/0x30
of_fwnode_get+0x43/0x70
fwnode_handle_get+0x54/0x80
fwnode_get_nth_parent+0xc9/0xe0
fwnode_full_name_string+0x3f/0xa0
device_node_string+0x30f/0x750
pointer+0x598/0x7a0
vsnprintf+0x62d/0x9b0
...
cfs_overlay_release+0x30/0x90
config_item_release+0xbe/0x1a0
config_item_put+0x5e/0x80
configfs_rmdir+0x3bd/0x540
vfs_rmdir+0x18c/0x320
do_rmdir+0x198/0x330
__x64_sys_rmdir+0x2c/0x40
do_syscall_64+0x37/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
[<miquel.raynal@bootlin.com>: Light reword of the commit log]
Security readout for executives and security teams
Plain-English summary
CVE-2022-50457 is a Linux kernel bug in MTD device removal that can leave a device-tree node reference unreleased. The public record describes a refcount leak, not data theft or remote code execution. Business urgency depends on whether your Linux kernels use MTD and device-tree overlay behavior.
Executive priority
Treat as a routine Linux kernel hygiene item unless your environment includes embedded or specialized Linux systems using MTD and device-tree overlays. There is no provided evidence of active exploitation, but the incomplete severity data means exposure should still be confirmed.
Technical view
In del_mtd_device(), mtd->dev is cleared before of_node_put() retrieves mtd->dev.of_node, causing of_node_put(NULL) and leaving of_node_get()/of_node_put() unbalanced. The fix caches the device_node pointer before clearing the device structure.
Likely exposure
Exposure is most likely on Linux systems running affected kernel versions that use MTD devices and Open Firmware/device-tree nodes or overlays. The source lists Linux kernel version entries including 5.17, 6.0.16, 6.1.2, and 6.2, but distro backport status is not provided.
Exploitation context
The bundle does not show CISA KEV listing, active exploitation, public exploit evidence, CVSS, or CWE mapping. The provided trace shows a memory/refcount leak triggered during overlay removal, but no source states attacker prerequisites or security impact beyond the leak.
Researcher notes
The evidence supports a kernel lifecycle bug: clearing mtd->dev before releasing its of_node loses the reference target. The record does not establish exploitability, privilege requirements, or confidentiality/integrity impact. Focus analysis on affected kernel branch mapping and whether local workflows can repeatedly trigger overlay removal.
Mitigation direction
Check Linux vendor advisories for patched kernel packages or backports.
Review the referenced stable kernel commits for the relevant maintained branch.
Prioritize embedded, appliance, and storage platforms using MTD or overlays.
Avoid direct kernel deployment assumptions; validate distro-specific fixed versions.
Track this under routine kernel maintenance unless local exposure is confirmed.
Validation and detection
Inventory kernels against vendor package metadata and upstream affected version references.
Identify systems using MTD subsystems, device-tree, or configfs overlays.
Check whether fixes matching the referenced stable commits are present.
Review kernel logs for OF refcount leak or overlay release warnings.
Confirm remediation through vendor kernel changelogs or source package patches.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2022-50457 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
0CVSS vectors
3Timeline events
0ADP providers
4Source links
Vulnerability timeline
Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.
CVE reservedCVE Program
The CVE ID was reserved by the assigning CNA.
CVE publishedCVE Program
The CVE record was published.
Oct 1, 2025, 11:45 UTC (UTC+00:00)
CVE updatedCVE Program
The CVE record metadata indicates this as the latest update time.