CVE-2022-50529 in Linuxinfo

Summary

by MITRE • 10/07/2025

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

test_firmware: fix memory leak in test_firmware_init()

When misc_register() failed in test_firmware_init(), the memory pointed by test_fw_config->name is not released. The memory leak information is as follows: unreferenced object 0xffff88810a34cb00 (size 32): comm "insmod", pid 7952, jiffies 4294948236 (age 49.060s) hex dump (first 32 bytes): 74 65 73 74 2d 66 69 72 6d 77 61 72 65 2e 62 69 test-firmware.bi 6e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 n............... backtrace: [<ffffffff81b21fcb>] __kmalloc_node_track_caller+0x4b/0xc0
[<ffffffff81affb96>] kstrndup+0x46/0xc0
[<ffffffffa0403a49>] __test_firmware_config_init+0x29/0x380 [test_firmware]
[<ffffffffa040f068>] 0xffffffffa040f068
[<ffffffff81002c41>] do_one_initcall+0x141/0x780
[<ffffffff816a72c3>] do_init_module+0x1c3/0x630
[<ffffffff816adb9e>] load_module+0x623e/0x76a0
[<ffffffff816af471>] __do_sys_finit_module+0x181/0x240
[<ffffffff89978f99>] do_syscall_64+0x39/0xb0
[<ffffffff89a0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

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

Analysis

by VulDB Data Team • 04/19/2026

The vulnerability CVE-2022-50529 represents a memory leak within the Linux kernel's test_firmware module, specifically in the test_firmware_init() function. This issue occurs during the initialization process when the misc_register() function fails, leaving allocated memory unreleased. The affected component is part of the kernel's testing framework designed to simulate firmware loading scenarios for development and testing purposes. The memory leak manifests as an unreferenced object of 32 bytes containing the string "test-firmware.bin" which is allocated during the configuration initialization phase. This type of vulnerability falls under CWE-401: Improper Release of Memory and aligns with ATT&CK technique T1484.001: Privilege Escalation through Kernel Memory Corruption.

The technical flaw stems from improper error handling within the test_firmware_init() function where memory allocation occurs through kstrndup() to duplicate the firmware configuration name string, but this memory is not freed when misc_register() subsequently fails. The kernel's module loading mechanism attempts to register the test firmware device through misc_register(), and when this registration fails, the code path does not execute the cleanup routine that would normally free the allocated memory. This creates a memory leak that persists until the kernel module is unloaded or the system reboots, potentially leading to gradual memory exhaustion over time.

The operational impact of this vulnerability is significant for systems running kernel versions containing this flaw, particularly in environments where kernel modules are frequently loaded and unloaded during development or testing cycles. While the test_firmware module itself is intended for testing purposes and not typically deployed in production systems, the vulnerability demonstrates poor memory management practices that could potentially be replicated in other kernel components. The leak affects the kernel's memory management subsystem by consuming unnecessary resources that could otherwise be utilized for legitimate kernel operations, potentially degrading system performance and stability over extended periods of operation.

Mitigation strategies for CVE-2022-50529 involve applying the official kernel patch that ensures proper memory cleanup when misc_register() fails. System administrators should update to kernel versions that contain the fix, typically those released after the vulnerability disclosure. For environments where immediate patching is not feasible, monitoring for memory leaks and implementing regular system restarts can help mitigate the impact. The fix implements proper error handling that releases the allocated memory through kfree() when the registration fails, ensuring that all allocated resources are properly managed according to kernel memory management best practices. This vulnerability highlights the importance of thorough error handling in kernel code and adherence to memory management principles that prevent resource leaks in critical system components.

Responsible

Linux

Reservation

10/07/2025

Disclosure

10/07/2025

Moderation

accepted

CPE

ready

EPSS

0.00143

KEV

no

Activities

very low

Sources

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!