CVE-2022-50331 in Linuxinfo

Summary

by MITRE • 09/15/2025

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

wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new()

Inject fault while probing module, if device_register() fails, but the refcount of kobject is not decreased to 0, the name allocated in dev_set_name() is leaked. Fix this by calling put_device(), so that name can be freed in callback function kobject_cleanup().

unreferenced object 0xffff88810152ad20 (size 8): comm "modprobe", pid 252, jiffies 4294849206 (age 22.713s) hex dump (first 8 bytes): 68 77 73 69 6d 30 00 ff hwsim0.. backtrace: [<000000009c3504ed>] __kmalloc_node_track_caller+0x44/0x1b0
[<00000000c0228a5e>] kvasprintf+0xb5/0x140
[<00000000cff8c21f>] kvasprintf_const+0x55/0x180
[<0000000055a1e073>] kobject_set_name_vargs+0x56/0x150
[<000000000a80b139>] dev_set_name+0xab/0xe0

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 01/10/2026

The vulnerability identified as CVE-2022-50331 resides within the Linux kernel's wwan_hwsim module, specifically addressing a memory leak condition that occurs during device initialization. This flaw manifests when the module probing process encounters a failure during device registration, creating a scenario where allocated memory remains unreleased. The issue is particularly significant as it represents a classic case of resource management failure in kernel space, where proper cleanup mechanisms are not executed upon error conditions. The wwan_hwsim module serves as a hardware simulation framework for wireless wide area network devices, making this vulnerability potentially exploitable in contexts involving wireless communication infrastructure.

The technical root cause of this memory leak stems from improper handling of reference counting within the kernel's device management subsystem. When device_register() fails during module initialization, the kobject reference count does not reach zero, preventing the automatic cleanup of memory allocated by dev_set_name(). This function allocates memory for device names using kernel memory allocation functions, specifically through kvasprintf and related mechanisms as evidenced by the backtrace showing __kmalloc_node_track_caller and kobject_set_name_vargs. The memory leak occurs because put_device() is not called to properly decrement the reference count, leaving the allocated name string in memory indefinitely. This represents a violation of proper resource management principles and aligns with CWE-401, which specifically addresses memory leaks in software systems.

The operational impact of this vulnerability extends beyond simple memory consumption, as persistent memory leaks can degrade system performance over time and potentially lead to system instability or resource exhaustion. The leak affects the kernel's memory management subsystem, where each instance of the fault results in a small but persistent memory allocation that cannot be reclaimed. The vulnerability is particularly concerning in environments where the wwan_hwsim module is frequently loaded and unloaded, as the cumulative effect of these leaks can significantly impact system resources. Additionally, this issue demonstrates a potential attack vector where malicious actors could exploit repeated module loading to cause progressive memory degradation, though the direct exploitability remains limited due to the specific conditions required for triggering the flaw.

Mitigation strategies for this vulnerability involve implementing proper error handling and resource cleanup procedures within the module's initialization sequence. The fix requires calling put_device() in error paths to ensure that reference counts are properly decremented, allowing the kobject cleanup mechanism to function correctly and free all allocated resources. This solution aligns with the ATT&CK framework's defensive techniques related to resource management and memory integrity. System administrators should ensure that affected kernel versions are updated promptly, as this vulnerability affects the core kernel functionality. The fix demonstrates the importance of proper reference counting in kernel modules and highlights the need for comprehensive error handling in device driver development, particularly in scenarios involving dynamic resource allocation and module loading operations.

Responsible

Linux

Reservation

09/15/2025

Disclosure

09/15/2025

Moderation

accepted

CPE

ready

EPSS

0.00143

KEV

no

Activities

very low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!