Skip to main content

CVE-2022-49300: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2022-49300cvecve-2022-49300
Published: Wed Feb 26 2025 (02/26/2025, 02:10:35 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: nbd: fix race between nbd_alloc_config() and module removal When nbd module is being removing, nbd_alloc_config() may be called concurrently by nbd_genl_connect(), although try_module_get() will return false, but nbd_alloc_config() doesn't handle it. The race may lead to the leak of nbd_config and its related resources (e.g, recv_workq) and oops in nbd_read_stat() due to the unload of nbd module as shown below: BUG: kernel NULL pointer dereference, address: 0000000000000040 Oops: 0000 [#1] SMP PTI CPU: 5 PID: 13840 Comm: kworker/u17:33 Not tainted 5.14.0+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) Workqueue: knbd16-recv recv_work [nbd] RIP: 0010:nbd_read_stat.cold+0x130/0x1a4 [nbd] Call Trace: recv_work+0x3b/0xb0 [nbd] process_one_work+0x1ed/0x390 worker_thread+0x4a/0x3d0 kthread+0x12a/0x150 ret_from_fork+0x22/0x30 Fixing it by checking the return value of try_module_get() in nbd_alloc_config(). As nbd_alloc_config() may return ERR_PTR(-ENODEV), assign nbd->config only when nbd_alloc_config() succeeds to ensure the value of nbd->config is binary (valid or NULL). Also adding a debug message to check the reference counter of nbd_config during module removal.

AI-Powered Analysis

AILast updated: 06/30/2025, 05:27:04 UTC

Technical Analysis

CVE-2022-49300 is a race condition vulnerability in the Linux kernel's Network Block Device (nbd) module. The issue arises during the removal of the nbd kernel module, where a race condition occurs between the function nbd_alloc_config() and the module removal process. Specifically, when the nbd module is being unloaded, nbd_alloc_config() may be called concurrently by nbd_genl_connect(). Although try_module_get() is designed to prevent module unloading by increasing the module's reference count, it can return false if the module is already being removed. However, nbd_alloc_config() does not properly handle this failure case. This leads to a situation where nbd_alloc_config() may return an error pointer (ERR_PTR(-ENODEV)), but the code incorrectly assigns this to nbd->config without validation. Consequently, this can cause a use-after-free or null pointer dereference in subsequent calls such as nbd_read_stat(), resulting in a kernel oops (crash). The vulnerability can cause resource leaks (e.g., nbd_config and recv_workq) and kernel instability. The fix involves checking the return value of try_module_get() within nbd_alloc_config() and only assigning nbd->config when allocation succeeds, ensuring the pointer is either valid or NULL. Additional debugging was added to monitor the reference count of nbd_config during module removal. This vulnerability affects Linux kernel versions containing the vulnerable nbd module code prior to the patch and can lead to denial of service via kernel crash or resource leakage. No known exploits are reported in the wild as of now, and the vulnerability requires concurrent module removal and nbd_alloc_config() invocation, which implies some level of local access or control over module operations.

Potential Impact

For European organizations, this vulnerability primarily poses a risk of denial of service (DoS) on Linux systems utilizing the nbd kernel module, which is commonly used for network-based block device access. Organizations relying on Linux servers, especially those using nbd for storage virtualization, network storage, or cloud infrastructure, could experience kernel crashes leading to system downtime or instability. This could disrupt critical services, data access, or cloud workloads. While the vulnerability does not directly enable privilege escalation or remote code execution, the resulting kernel oops can impact system availability and reliability. In environments with high security and uptime requirements, such as financial institutions, healthcare providers, and critical infrastructure operators in Europe, this could have operational and compliance implications. Additionally, resource leaks may degrade system performance over time. Since exploitation requires module removal and concurrent calls to nbd_alloc_config(), the threat is more relevant to environments where kernel modules are dynamically managed or where untrusted users have some level of system access. The lack of known exploits reduces immediate risk, but unpatched systems remain vulnerable to accidental or intentional DoS conditions.

Mitigation Recommendations

European organizations should apply the official Linux kernel patches that address CVE-2022-49300 as soon as possible. Specifically, update to a Linux kernel version that includes the fix for the nbd module race condition. For systems where immediate patching is not feasible, consider the following mitigations: restrict access to module loading and unloading operations to trusted administrators only, minimizing the risk of concurrent module removal and nbd_alloc_config() calls; monitor kernel logs for oops or errors related to nbd to detect potential exploitation or instability; disable the nbd module if it is not required for operational purposes to eliminate the attack surface; implement strict access controls and auditing on systems that use nbd to detect unauthorized attempts to manipulate kernel modules; and ensure robust backup and recovery procedures to mitigate impact from potential system crashes. Additionally, organizations should review their kernel module management policies and consider using kernel lockdown features or security modules (e.g., SELinux, AppArmor) to restrict dynamic kernel module operations.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2025-02-26T02:08:31.534Z
Cisa Enriched
false
Cvss Version
null
State
PUBLISHED

Threat ID: 682d982dc4522896dcbe5590

Added to database: 5/21/2025, 9:09:01 AM

Last enriched: 6/30/2025, 5:27:04 AM

Last updated: 8/1/2025, 7:15:11 PM

Views: 10

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats