Skip to contentSkip to conversation

CVE-2022-50734: nvmem: core: Fix memleak in nvmem_register()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 24, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

nvmem: core: Fix memleak in nvmem_register()

dev_set_name will alloc memory for nvmem->dev.kobj.name in nvmem_register, when nvmem_validate_keepouts failed, nvmem's memory will be freed and return, but nobody will free memory for nvmem->dev.kobj.name, there will be memleak, so moving nvmem_validate_keepouts() after device_register() and let the device core deal with cleaning name in error cases.

The Linux kernel CVE team has assigned CVE-2022-50734 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.15 with commit de0534df93474f268486c486ea7e01b44a478026 and fixed in 5.15.75 with commit 9391cc3a787a58aa224a6440d7f244d780ba2896
	Issue introduced in 5.15 with commit de0534df93474f268486c486ea7e01b44a478026 and fixed in 5.19.17 with commit 2bd2774df0ce37920b23819a860a66fdbdd90823
	Issue introduced in 5.15 with commit de0534df93474f268486c486ea7e01b44a478026 and fixed in 6.0.3 with commit b6054b9b239a493672f853b034570cca93ba7a88
	Issue introduced in 5.15 with commit de0534df93474f268486c486ea7e01b44a478026 and fixed in 6.1 with commit bd1244561fa2a4531ded40dbf09c9599084f8b29
	Issue introduced in 5.13.19 with commit c1d44b93ca9f3ebc26b0de0a7f4b7156702762b6
	Issue introduced in 5.14.6 with commit 63c2b13ba0428b8f477e4adb1d40a50eb4493c09

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2022-50734

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/nvmem/core.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/9391cc3a787a58aa224a6440d7f244d780ba2896
	https://git.kernel.org/stable/c/2bd2774df0ce37920b23819a860a66fdbdd90823
	https://git.kernel.org/stable/c/b6054b9b239a493672f853b034570cca93ba7a88
	https://git.kernel.org/stable/c/bd1244561fa2a4531ded40dbf09c9599084f8b29