CVE-2022-50457 (GCVE-0-2022-50457)

Vulnerability from cvelistv5 – Published: 2025-10-01 11:45 – Updated: 2026-05-11 19:19
VLAI
Title
mtd: core: Fix refcount error in del_mtd_device()
Summary
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]
Impacted products
Vendor Product Version CPE status
Linux Linux Affected: 00596576a05145a1b5672897a82ef87af00becf4 , < f6016557f1ef7735963bd8691592d2797bbf91d2 (git)
Affected: 00596576a05145a1b5672897a82ef87af00becf4 , < 616dc895d982026f41f500c88d1bfea004938cc8 (git)
Affected: 00596576a05145a1b5672897a82ef87af00becf4 , < 56570bdad5e31c5c538cd6efff5c4510256e1bb4 (git)
guessed Create a notification for this product.
Linux Linux Affected: 5.17
Unaffected: 0 , < 5.17 (semver)
Unaffected: 6.0.16 , ≤ 6.0.* (semver)
Unaffected: 6.1.2 , ≤ 6.1.* (semver)
Unaffected: 6.2 , ≤ * (original_commit_for_fix)
guessed Create a notification for this product.
Show details on NVD website

{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "drivers/mtd/mtdcore.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "f6016557f1ef7735963bd8691592d2797bbf91d2",
              "status": "affected",
              "version": "00596576a05145a1b5672897a82ef87af00becf4",
              "versionType": "git"
            },
            {
              "lessThan": "616dc895d982026f41f500c88d1bfea004938cc8",
              "status": "affected",
              "version": "00596576a05145a1b5672897a82ef87af00becf4",
              "versionType": "git"
            },
            {
              "lessThan": "56570bdad5e31c5c538cd6efff5c4510256e1bb4",
              "status": "affected",
              "version": "00596576a05145a1b5672897a82ef87af00becf4",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "drivers/mtd/mtdcore.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "5.17"
            },
            {
              "lessThan": "5.17",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.0.*",
              "status": "unaffected",
              "version": "6.0.16",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.2",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.2",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.0.16",
                  "versionStartIncluding": "5.17",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.1.2",
                  "versionStartIncluding": "5.17",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.2",
                  "versionStartIncluding": "5.17",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nmtd: core: Fix refcount error in del_mtd_device()\n\ndel_mtd_device() will call of_node_put() to mtd_get_of_node(mtd), which\nis mtd-\u003edev.of_node. However, memset(\u0026mtd-\u003edev, 0) is called before\nof_node_put(). As the result, of_node_put() won\u0027t do anything in\ndel_mtd_device(), and causes the refcount leak.\n\ndel_mtd_device()\n    memset(\u0026mtd-\u003edev, 0, sizeof(mtd-\u003edev) # clear mtd-\u003edev\n    of_node_put()\n        mtd_get_of_node(mtd) # mtd-\u003edev is cleared, can\u0027t locate of_node\n                             # of_node_put(NULL) won\u0027t do anything\n\nFix the error by caching the pointer of the device_node.\n\nOF: ERROR: memory leak, expected refcount 1 instead of 2,\nof_node_get()/of_node_put() unbalanced - destroy cset entry: attach\noverlay node /spi/spi-sram@0\nCPU: 3 PID: 275 Comm: python3 Tainted: G N 6.1.0-rc3+ #54\n    0d8a1edddf51f172ff5226989a7565c6313b08e2\nHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS\nrel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014\nCall Trace:\n\u003cTASK\u003e\n    dump_stack_lvl+0x67/0x83\n    kobject_get+0x155/0x160\n    of_node_get+0x1f/0x30\n    of_fwnode_get+0x43/0x70\n    fwnode_handle_get+0x54/0x80\n    fwnode_get_nth_parent+0xc9/0xe0\n    fwnode_full_name_string+0x3f/0xa0\n    device_node_string+0x30f/0x750\n    pointer+0x598/0x7a0\n    vsnprintf+0x62d/0x9b0\n    ...\n    cfs_overlay_release+0x30/0x90\n    config_item_release+0xbe/0x1a0\n    config_item_put+0x5e/0x80\n    configfs_rmdir+0x3bd/0x540\n    vfs_rmdir+0x18c/0x320\n    do_rmdir+0x198/0x330\n    __x64_sys_rmdir+0x2c/0x40\n    do_syscall_64+0x37/0x90\n    entry_SYSCALL_64_after_hwframe+0x63/0xcd\n\n[\u003cmiquel.raynal@bootlin.com\u003e: Light reword of the commit log]"
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-05-11T19:19:49.540Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/f6016557f1ef7735963bd8691592d2797bbf91d2"
        },
        {
          "url": "https://git.kernel.org/stable/c/616dc895d982026f41f500c88d1bfea004938cc8"
        },
        {
          "url": "https://git.kernel.org/stable/c/56570bdad5e31c5c538cd6efff5c4510256e1bb4"
        }
      ],
      "title": "mtd: core: Fix refcount error in del_mtd_device()",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2022-50457",
    "datePublished": "2025-10-01T11:45:30.263Z",
    "dateReserved": "2025-10-01T11:38:45.640Z",
    "dateUpdated": "2026-05-11T19:19:49.540Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "epss": {
      "cve": "CVE-2022-50457",
      "date": "2026-09-26",
      "epss": "0.00154",
      "percentile": "0.03803"
    },
    "nvd": {
      "cve": {
        "affected": [
          {
            "affectedData": [
              {
                "defaultStatus": "unaffected",
                "product": "Linux",
                "programFiles": [
                  "drivers/mtd/mtdcore.c"
                ],
                "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                "vendor": "Linux",
                "versions": [
                  {
                    "lessThan": "f6016557f1ef7735963bd8691592d2797bbf91d2",
                    "status": "affected",
                    "version": "00596576a05145a1b5672897a82ef87af00becf4",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "616dc895d982026f41f500c88d1bfea004938cc8",
                    "status": "affected",
                    "version": "00596576a05145a1b5672897a82ef87af00becf4",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "56570bdad5e31c5c538cd6efff5c4510256e1bb4",
                    "status": "affected",
                    "version": "00596576a05145a1b5672897a82ef87af00becf4",
                    "versionType": "git"
                  }
                ]
              },
              {
                "defaultStatus": "affected",
                "product": "Linux",
                "programFiles": [
                  "drivers/mtd/mtdcore.c"
                ],
                "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                "vendor": "Linux",
                "versions": [
                  {
                    "status": "affected",
                    "version": "5.17"
                  },
                  {
                    "lessThan": "5.17",
                    "status": "unaffected",
                    "version": "0",
                    "versionType": "semver"
                  },
                  {
                    "lessThanOrEqual": "6.0.*",
                    "status": "unaffected",
                    "version": "6.0.16",
                    "versionType": "semver"
                  },
                  {
                    "lessThanOrEqual": "6.1.*",
                    "status": "unaffected",
                    "version": "6.1.2",
                    "versionType": "semver"
                  },
                  {
                    "lessThanOrEqual": "*",
                    "status": "unaffected",
                    "version": "6.2",
                    "versionType": "original_commit_for_fix"
                  }
                ]
              }
            ],
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
          }
        ],
        "configurations": [
          {
            "nodes": [
              {
                "cpeMatch": [
                  {
                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                    "matchCriteriaId": "2701BF1F-7C10-4D86-93E6-AA6DF5D8A6A3",
                    "versionEndExcluding": "6.0.16",
                    "versionStartIncluding": "5.17",
                    "vulnerable": true
                  },
                  {
                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                    "matchCriteriaId": "77239F4B-6BB2-4B9E-A654-36A52396116C",
                    "versionEndExcluding": "6.1.2",
                    "versionStartIncluding": "6.1",
                    "vulnerable": true
                  }
                ],
                "negate": false,
                "operator": "OR"
              }
            ]
          }
        ],
        "cveTags": [],
        "descriptions": [
          {
            "lang": "en",
            "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nmtd: core: Fix refcount error in del_mtd_device()\n\ndel_mtd_device() will call of_node_put() to mtd_get_of_node(mtd), which\nis mtd-\u003edev.of_node. However, memset(\u0026mtd-\u003edev, 0) is called before\nof_node_put(). As the result, of_node_put() won\u0027t do anything in\ndel_mtd_device(), and causes the refcount leak.\n\ndel_mtd_device()\n    memset(\u0026mtd-\u003edev, 0, sizeof(mtd-\u003edev) # clear mtd-\u003edev\n    of_node_put()\n        mtd_get_of_node(mtd) # mtd-\u003edev is cleared, can\u0027t locate of_node\n                             # of_node_put(NULL) won\u0027t do anything\n\nFix the error by caching the pointer of the device_node.\n\nOF: ERROR: memory leak, expected refcount 1 instead of 2,\nof_node_get()/of_node_put() unbalanced - destroy cset entry: attach\noverlay node /spi/spi-sram@0\nCPU: 3 PID: 275 Comm: python3 Tainted: G N 6.1.0-rc3+ #54\n    0d8a1edddf51f172ff5226989a7565c6313b08e2\nHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS\nrel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014\nCall Trace:\n\u003cTASK\u003e\n    dump_stack_lvl+0x67/0x83\n    kobject_get+0x155/0x160\n    of_node_get+0x1f/0x30\n    of_fwnode_get+0x43/0x70\n    fwnode_handle_get+0x54/0x80\n    fwnode_get_nth_parent+0xc9/0xe0\n    fwnode_full_name_string+0x3f/0xa0\n    device_node_string+0x30f/0x750\n    pointer+0x598/0x7a0\n    vsnprintf+0x62d/0x9b0\n    ...\n    cfs_overlay_release+0x30/0x90\n    config_item_release+0xbe/0x1a0\n    config_item_put+0x5e/0x80\n    configfs_rmdir+0x3bd/0x540\n    vfs_rmdir+0x18c/0x320\n    do_rmdir+0x198/0x330\n    __x64_sys_rmdir+0x2c/0x40\n    do_syscall_64+0x37/0x90\n    entry_SYSCALL_64_after_hwframe+0x63/0xcd\n\n[\u003cmiquel.raynal@bootlin.com\u003e: Light reword of the commit log]"
          }
        ],
        "id": "CVE-2022-50457",
        "lastModified": "2026-06-17T05:23:35.617",
        "metrics": {
          "cvssMetricV31": [
            {
              "cvssData": {
                "attackComplexity": "LOW",
                "attackVector": "LOCAL",
                "availabilityImpact": "HIGH",
                "baseScore": 5.5,
                "baseSeverity": "MEDIUM",
                "confidentialityImpact": "NONE",
                "integrityImpact": "NONE",
                "privilegesRequired": "LOW",
                "scope": "UNCHANGED",
                "userInteraction": "NONE",
                "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
                "version": "3.1"
              },
              "exploitabilityScore": 1.8,
              "impactScore": 3.6,
              "source": "nvd@nist.gov",
              "type": "Primary"
            }
          ]
        },
        "published": "2025-10-01T12:15:38.967",
        "references": [
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "tags": [
              "Patch"
            ],
            "url": "https://git.kernel.org/stable/c/56570bdad5e31c5c538cd6efff5c4510256e1bb4"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "tags": [
              "Patch"
            ],
            "url": "https://git.kernel.org/stable/c/616dc895d982026f41f500c88d1bfea004938cc8"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "tags": [
              "Patch"
            ],
            "url": "https://git.kernel.org/stable/c/f6016557f1ef7735963bd8691592d2797bbf91d2"
          }
        ],
        "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "vulnStatus": "Analyzed",
        "weaknesses": [
          {
            "description": [
              {
                "lang": "en",
                "value": "NVD-CWE-Other"
              }
            ],
            "source": "nvd@nist.gov",
            "type": "Primary"
          }
        ]
      }
    },
    "redhat_vex": {
      "aggregate_severity": "Low",
      "current_release_date": "2026-06-30T10:15:23+00:00",
      "cve": "CVE-2022-50457",
      "id": "CVE-2022-50457",
      "initial_release_date": "2022-01-01T00:00:00+00:00",
      "product_status:known_affected": "14",
      "product_status:known_not_affected": "260",
      "source": "Red Hat CSAF VEX",
      "status": "final",
      "title": "kernel: mtd: core: Fix refcount error in del_mtd_device()",
      "url": "https://security.access.redhat.com/data/csaf/v2/vex/2022/cve-2022-50457.json",
      "version": "3"
    },
    "suse_vex": {
      "aggregate_severity": "moderate",
      "current_release_date": "2026-09-01T01:24:33Z",
      "cve": "CVE-2022-50457",
      "id": "CVE-2022-50457",
      "initial_release_date": "2025-10-01T23:32:22Z",
      "product_status:known_not_affected": "523",
      "source": "SUSE CSAF VEX",
      "status": "interim",
      "title": "SUSE CVE CVE-2022-50457",
      "url": "https://ftp.suse.com/pub/projects/security/csaf-vex/cve-2022-50457.json",
      "version": "10"
    }
  }
}



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…

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…