CVE-2021-47195: spi: fix use-after-free of the add_lock mutex
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().
Security readout for executives and security teams
Plain-English summary
This is a Linux kernel memory-safety flaw in SPI controller cleanup. A lock could be released after the controller object was already freed, creating a use-after-free condition. The public record does not provide CVSS, confirmed impact, or attack prerequisites.
Executive priority
Treat as a targeted kernel maintenance issue unless your environment depends heavily on SPI hardware. Prioritize patch verification for embedded, IoT, industrial, and appliance-like Linux systems. There is no sourced evidence of active exploitation in the provided bundle.
Technical view
The bug is in the Linux SPI subsystem. A prior change added a per-controller add_lock mutex, but spi_unregister_controller() could call put_device(), trigger spi_controller_release(), and then unlock ctlr->add_lock after the controller memory was freed. The fix moves put_device() after mutex_unlock().
Likely exposure
Exposure appears limited to Linux kernels carrying the affected SPI code, especially systems using SPI controllers or SPI controller registration paths. The source metadata lists Linux 5.15, 5.15.5, and 5.16-related entries, but distro backports require vendor-specific verification.
Exploitation context
The provided sources do not report active exploitation, public exploit use, KEV listing, remote reachability, or required privileges. The evidence supports a kernel use-after-free during SPI controller unregister logic, but not a defined attacker path.
Researcher notes
Evidence is narrow but specific: the vulnerability is a lifetime-ordering error around add_lock and put_device() in SPI controller teardown. Do not assume exploitability characteristics beyond a kernel use-after-free without additional vendor or upstream analysis.
Mitigation direction
Check your Linux vendor advisory for CVE-2021-47195 coverage.
Upgrade to a kernel containing the referenced stable fix commits.
Prioritize embedded, appliance, and hardware-integrated systems using SPI.
Confirm whether vendor kernels backported the SPI controller fix.
Validation and detection
Inventory running kernel versions and vendor patch levels.
Check kernel source or changelog for the referenced stable commits.
Identify systems with SPI controller hardware or enabled SPI modules.
Review crash reports for SPI unregister or controller-release faults.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2021-47195 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.