CVE-2022-50734 in Linuxinfo

Summary

by MITRE • 12/24/2025

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.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 04/21/2026

The vulnerability identified as CVE-2022-50734 represents a memory leak in the Linux kernel's nvmem subsystem, specifically within the nvmem_register() function. This issue occurs in the context of non-volatile memory management where the kernel handles persistent storage devices and their associated data. The nvmem core subsystem is responsible for managing non-volatile memory devices that store configuration data, calibration information, and other persistent parameters essential for system operation. When the kernel attempts to register an nvmem device, it performs various validation steps before completing the registration process.

The technical flaw stems from the improper ordering of operations within the nvmem_register() function where dev_set_name() allocates memory for the device's kernel object name field. This memory allocation occurs before validation checks are completed. When the nvmem_validate_keepouts() function fails during the validation process, the nvmem structure itself gets freed, but the memory allocated for nvmem->dev.kobj.name remains unreleased. This represents a classic memory leak scenario where allocated resources are not properly deallocated during error conditions. The vulnerability manifests as a memory leak because the kernel's device core subsystem is not given the opportunity to clean up the allocated name memory when the registration process fails early.

The operational impact of this memory leak, while seemingly small in individual instances, can accumulate over time in systems with frequent nvmem device registration operations. This becomes particularly concerning in embedded systems or server environments where the kernel may repeatedly attempt to register nvmem devices during boot processes, device enumeration, or hotplug events. The leak can contribute to gradual memory consumption issues that may affect system performance, particularly in resource-constrained environments. The vulnerability affects systems using the Linux kernel version 5.19 and earlier, making it relevant to a broad range of embedded devices, IoT systems, and server platforms that rely on nvmem for persistent storage management.

The fix implemented for CVE-2022-50734 addresses the root cause by reordering the function calls within nvmem_register(). Specifically, the nvmem_validate_keepouts() validation is moved to occur after device_register() has been called. This reordering ensures that when errors occur during validation, the device core subsystem can properly handle cleanup operations including freeing the memory allocated for the device name. This approach leverages the kernel's established error handling patterns where device registration functions are expected to properly manage cleanup when registration fails. The solution aligns with common kernel development practices and follows the principle of ensuring that all allocated resources are properly freed during error conditions, which is a fundamental requirement for robust kernel code.

This vulnerability maps to CWE-401, which specifically addresses Improper Release of Memory Before Removing Last Reference, and demonstrates the importance of proper resource management in kernel space operations. The fix also aligns with ATT&CK technique T1059.003, which involves the use of command-line interfaces, as this memory leak could potentially be exploited to cause system instability or resource exhaustion through repeated registration attempts. The nvmem subsystem's role in system configuration and device management makes this vulnerability particularly significant for maintaining system integrity and preventing potential denial-of-service conditions that could affect critical embedded systems or server platforms relying on persistent memory storage for essential configuration data.

Responsible

Linux

Reservation

12/24/2025

Disclosure

12/24/2025

Moderation

accepted

CPE

ready

EPSS

0.00208

KEV

no

Activities

very low

Sources

Do you need the next level of professionalism?

Upgrade your account now!