CVE-2021-47195: Vulnerability in Linux Linux
In the Linux kernel, the following vulnerability has been resolved: spi: fix use-after-free of the add_lock mutex Commit 6098475d4cb4 ("spi: Fix deadlock when adding SPI controllers on SPI buses") introduced a per-controller mutex. But mutex_unlock() of said lock is called after the controller is already freed: spi_unregister_controller(ctlr) -> put_device(&ctlr->dev) -> spi_controller_release(dev) -> mutex_unlock(&ctrl->add_lock) Move the put_device() after the mutex_unlock().
AI Analysis
Technical Summary
CVE-2021-47195 is a use-after-free vulnerability in the Linux kernel's SPI (Serial Peripheral Interface) subsystem. The flaw arises from improper handling of a mutex lock related to SPI controller registration and unregistration. Specifically, a commit (6098475d4cb4) introduced a per-controller mutex (add_lock) to prevent deadlocks when adding SPI controllers on SPI buses. However, the mutex_unlock() call occurs after the SPI controller has already been freed via put_device(), leading to a use-after-free condition. The sequence is as follows: spi_unregister_controller() calls put_device() on the controller's device, which triggers spi_controller_release(), freeing the controller, and only then is mutex_unlock() called on the add_lock mutex. This ordering is incorrect because it attempts to unlock a mutex associated with a freed object, causing undefined behavior and potential kernel memory corruption. The fix involves moving the put_device() call to occur after the mutex_unlock(), ensuring the mutex is released before the controller is freed. This vulnerability affects specific Linux kernel versions identified by their commit hashes and was published on April 10, 2024. There are no known exploits in the wild at this time, and no CVSS score has been assigned. The vulnerability is technical and low-level, impacting kernel stability and security, particularly in systems using SPI controllers, which are common in embedded and IoT devices running Linux.
Potential Impact
For European organizations, the impact of CVE-2021-47195 depends largely on the deployment of Linux-based systems that utilize SPI controllers. Many industrial control systems, embedded devices, and IoT infrastructure in sectors such as manufacturing, automotive, telecommunications, and critical infrastructure rely on Linux kernels with SPI support. Exploitation of this vulnerability could lead to kernel crashes, denial of service, or potentially privilege escalation if an attacker can trigger the use-after-free condition. This could disrupt operational technology environments or embedded systems critical to European industries. Although no active exploits are known, the vulnerability poses a risk to system integrity and availability, especially in environments where SPI devices are dynamically added or removed. The risk is heightened in scenarios where untrusted users or processes have the ability to interact with SPI devices or load/unload SPI controllers. Confidentiality impact is limited unless combined with other vulnerabilities, but integrity and availability impacts are significant due to potential kernel crashes or memory corruption.
Mitigation Recommendations
European organizations should prioritize updating their Linux kernels to versions where this vulnerability is patched, ensuring the fix that reorders the mutex_unlock() and put_device() calls is applied. For embedded and IoT devices, firmware updates incorporating the patched kernel should be deployed promptly. Organizations should audit their use of SPI controllers and restrict access to SPI device management interfaces to trusted users and processes only. Employing kernel hardening techniques such as Kernel Address Space Layout Randomization (KASLR), Kernel Page Table Isolation (KPTI), and enabling kernel lockdown modes can reduce exploitation risk. Monitoring kernel logs for unusual SPI controller registration/unregistration activity may help detect exploitation attempts. In environments where immediate patching is not feasible, isolating affected systems and limiting user privileges can mitigate risk. Vendors and integrators should verify that their Linux distributions include the fix and communicate updates to customers. Finally, organizations should maintain robust backup and recovery procedures to minimize operational impact in case of exploitation.
Affected Countries
Germany, France, United Kingdom, Netherlands, Italy, Spain, Sweden, Finland, Poland, Belgium
CVE-2021-47195: Vulnerability in Linux Linux
Description
In the Linux kernel, the following vulnerability has been resolved: spi: fix use-after-free of the add_lock mutex Commit 6098475d4cb4 ("spi: Fix deadlock when adding SPI controllers on SPI buses") introduced a per-controller mutex. But mutex_unlock() of said lock is called after the controller is already freed: spi_unregister_controller(ctlr) -> put_device(&ctlr->dev) -> spi_controller_release(dev) -> mutex_unlock(&ctrl->add_lock) Move the put_device() after the mutex_unlock().
AI-Powered Analysis
Technical Analysis
CVE-2021-47195 is a use-after-free vulnerability in the Linux kernel's SPI (Serial Peripheral Interface) subsystem. The flaw arises from improper handling of a mutex lock related to SPI controller registration and unregistration. Specifically, a commit (6098475d4cb4) introduced a per-controller mutex (add_lock) to prevent deadlocks when adding SPI controllers on SPI buses. However, the mutex_unlock() call occurs after the SPI controller has already been freed via put_device(), leading to a use-after-free condition. The sequence is as follows: spi_unregister_controller() calls put_device() on the controller's device, which triggers spi_controller_release(), freeing the controller, and only then is mutex_unlock() called on the add_lock mutex. This ordering is incorrect because it attempts to unlock a mutex associated with a freed object, causing undefined behavior and potential kernel memory corruption. The fix involves moving the put_device() call to occur after the mutex_unlock(), ensuring the mutex is released before the controller is freed. This vulnerability affects specific Linux kernel versions identified by their commit hashes and was published on April 10, 2024. There are no known exploits in the wild at this time, and no CVSS score has been assigned. The vulnerability is technical and low-level, impacting kernel stability and security, particularly in systems using SPI controllers, which are common in embedded and IoT devices running Linux.
Potential Impact
For European organizations, the impact of CVE-2021-47195 depends largely on the deployment of Linux-based systems that utilize SPI controllers. Many industrial control systems, embedded devices, and IoT infrastructure in sectors such as manufacturing, automotive, telecommunications, and critical infrastructure rely on Linux kernels with SPI support. Exploitation of this vulnerability could lead to kernel crashes, denial of service, or potentially privilege escalation if an attacker can trigger the use-after-free condition. This could disrupt operational technology environments or embedded systems critical to European industries. Although no active exploits are known, the vulnerability poses a risk to system integrity and availability, especially in environments where SPI devices are dynamically added or removed. The risk is heightened in scenarios where untrusted users or processes have the ability to interact with SPI devices or load/unload SPI controllers. Confidentiality impact is limited unless combined with other vulnerabilities, but integrity and availability impacts are significant due to potential kernel crashes or memory corruption.
Mitigation Recommendations
European organizations should prioritize updating their Linux kernels to versions where this vulnerability is patched, ensuring the fix that reorders the mutex_unlock() and put_device() calls is applied. For embedded and IoT devices, firmware updates incorporating the patched kernel should be deployed promptly. Organizations should audit their use of SPI controllers and restrict access to SPI device management interfaces to trusted users and processes only. Employing kernel hardening techniques such as Kernel Address Space Layout Randomization (KASLR), Kernel Page Table Isolation (KPTI), and enabling kernel lockdown modes can reduce exploitation risk. Monitoring kernel logs for unusual SPI controller registration/unregistration activity may help detect exploitation attempts. In environments where immediate patching is not feasible, isolating affected systems and limiting user privileges can mitigate risk. Vendors and integrators should verify that their Linux distributions include the fix and communicate updates to customers. Finally, organizations should maintain robust backup and recovery procedures to minimize operational impact in case of exploitation.
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- Linux
- Date Reserved
- 2024-03-25T09:12:14.114Z
- Cisa Enriched
- true
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 682d9822c4522896dcbde090
Added to database: 5/21/2025, 9:08:50 AM
Last enriched: 6/28/2025, 4:56:49 AM
Last updated: 10/16/2025, 9:02:15 AM
Views: 23
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2025-0277: CWE-693 Protection Mechanism Failure in HCL Software BigFix Mobile
MediumCVE-2025-54539: CWE-502 Deserialization of Untrusted Data in Apache Software Foundation Apache ActiveMQ NMS AMQP Client
HighCVE-2025-0276: CWE-693 Protection Mechanism Failure in HCL Software BigFix Modern Client Management
MediumCVE-2024-0400: CWE-94 Improper Control of Generation of Code ('Code Injection') in Hitachi Energy MACH SCM
HighCVE-2025-55090: CWE-125 Out-of-bounds Read in Eclipse Foundation NetX Duo
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.