Cloudanix VulnDB

CVE-2021-46959

None

CVSS

—

EPSS

0.2%

Published

Feb 29, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A bug in how the operating system cleans up certain hardware communication components can cause crashes or instability on affected computers and devices.

Exploitation
Local Privilege
Attacker needs
Local User
Complexity
High
Impact
Other
Component
OS kernel
Class
Use After Free
Remediation
Patch
Effort
Medium
Patch risk
Low

What it actually does

The flaw causes devm-managed SPI controllers to be incorrectly treated as legacy devices during unregister, decrementing their reference counts below zero and triggering use-after-free conditions in the kernel's device model.

Why it matters to the business

Kernel instability or crashes on systems using SPI devices can lead to denial of service, unexpected reboots, and potential data loss or corruption in storage or embedded environments; low exploitability reduces immediate risk but still requires patching for stability.

How an attack unfolds

An attacker with local access triggers SPI controller registration via devm_spi_alloc followed by unbind or driver detach operations; the torn-down devres list causes erroneous reference counting during cleanup, saturating refcounts and potentially allowing memory reuse attacks.

How to fix it

Update to a Linux kernel containing the fix for this use-after-free in the SPI devm allocation path; rebuild and reboot affected systems; avoid manual unbind operations on SPI controllers until patched.

How to confirm the fix worked

Confirm kernel version includes the commit resolving the devm_spi_release_controller refcount issue; attempt SPI device registration/unregistration cycles and verify absence of refcount_warn_saturate warnings in dmesg.

Typical attack path

  1. Obtain local access or execute code on the target system
  2. Load or trigger SPI device drivers that use devm_spi_alloc_master/slave
  3. Perform unbind or driver detach to invoke spi_unregister_controller
  4. Trigger the faulty devres_find path leading to refcount underflow
  5. Exploit resulting UAF for memory corruption or crash

How to detect it

Inspect kernel logs for refcount_warn_saturate or kobject_put warnings during device_driver_detach or unbind_store; look for SPI controller teardown sequences in dmesg or system journals around crash times.

What your security team should do

  • Prioritize kernel updates on embedded, IoT, and storage systems using SPI
  • Monitor for refcount warnings in kernel logs on unpatched systems
  • Restrict unprivileged access to driver bind/unbind interfaces where possible

The record

In the Linux kernel, the following vulnerability has been resolved: spi: Fix use-after-free with devm_spi_alloc_* We can't rely on the contents of the devres list during spi_unregister_controller(), as the list is already torn down at the time we perform devres_find() for devm_spi_release_controller. This causes devices registered with devm_spi_alloc_{master,slave}() to be mistakenly identified as legacy, non-devm managed devices and have their reference counters decremented below 0. ------------[ cut here ]------------ WARNING: CPU: 1 PID: 660 at lib/refcount.c:28 refcount_warn_saturate+0x108/0x174 [<b0396f04>] (refcount_warn_saturate) from [<b03c56a4>] (kobject_put+0x90/0x98) [<b03c5614>] (kobject_put) from [<b0447b4c>] (put_device+0x20/0x24) r4:b6700140 [<b0447b2c>] (put_device) from [<b07515e8>] (devm_spi_release_controller+0x3c/0x40) [<b07515ac>] (devm_spi_release_controller) from [<b045343c>] (release_nodes+0x84/0xc4) r5:b6700180 r4:b6700100 [<b04533b8>] (release_nodes) from [<b0454160>] (devres_release_all+0x5c/0x60) r8:b1638c54 r7:b117ad94 r6:b1638c10 r5:b117ad94 r4:b163dc10 [<b0454104>] (devres_release_all) from [<b044e41c>] (__device_release_driver+0x144/0x1ec) r5:b117ad94 r4:b163dc10 [<b044e2d8>] (__device_release_driver) from [<b044f70c>] (device_driver_detach+0x84/0xa0) r9:00000000 r8:00000000 r7:b117ad94 r6:b163dc54 r5:b1638c10 r4:b163dc10 [<b044f688>] (device_driver_detach) from [<b044d274>] (unbind_store+0xe4/0xf8) Instead, determine the devm allocation state as a flag on the controller which is guaranteed to be stable during cleanup.

Affected packages

Ecosystem Package Introduced Fixed
Debian:11 linux 0 5.10.38-1
Debian:12 linux 0 5.10.38-1
Debian:13 linux 0 5.10.38-1
SUSE:Enterprise Storage 7.1 kernel-64kb 0 5.3.18-150300.59.158.1
SUSE:Enterprise Storage 7.1 kernel-default 0 5.3.18-150300.59.158.1
SUSE:Enterprise Storage 7.1 kernel-default-base 0 5.3.18-150300.59.158.1.150300.18.92.5
SUSE:Enterprise Storage 7.1 kernel-docs 0 5.3.18-150300.59.158.1
SUSE:Enterprise Storage 7.1 kernel-obs-build 0 5.3.18-150300.59.158.1
SUSE:Enterprise Storage 7.1 kernel-preempt 0 5.3.18-150300.59.158.1
SUSE:Enterprise Storage 7.1 kernel-source 0 5.3.18-150300.59.158.1
SUSE:Enterprise Storage 7.1 kernel-syms 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise High Availability Extension 15 SP3 kernel-default 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS kernel-64kb 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS kernel-default 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS kernel-default-base 0 5.3.18-150300.59.158.1.150300.18.92.5
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS kernel-docs 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS kernel-obs-build 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS kernel-preempt 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS kernel-source 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS kernel-syms 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Live Patching 15 SP3 kernel-default 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Live Patching 15 SP3 kernel-livepatch-SLE15-SP3_Update_43 0 1-150300.7.3.5
SUSE:Linux Enterprise Micro 5.1 kernel-default 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Micro 5.1 kernel-default-base 0 5.3.18-150300.59.158.1.150300.18.92.5
SUSE:Linux Enterprise Micro 5.1 kernel-rt 0 5.3.18-150300.166.1
SUSE:Linux Enterprise Micro 5.1 kernel-source-rt 0 5.3.18-150300.166.1
SUSE:Linux Enterprise Micro 5.2 kernel-default 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Micro 5.2 kernel-default-base 0 5.3.18-150300.59.158.1.150300.18.92.5
SUSE:Linux Enterprise Micro 5.2 kernel-rt 0 5.3.18-150300.166.1
SUSE:Linux Enterprise Micro 5.2 kernel-source-rt 0 5.3.18-150300.166.1
SUSE:Linux Enterprise Server 15 SP3-LTSS kernel-64kb 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server 15 SP3-LTSS kernel-default 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server 15 SP3-LTSS kernel-default-base 0 5.3.18-150300.59.158.1.150300.18.92.5
SUSE:Linux Enterprise Server 15 SP3-LTSS kernel-docs 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server 15 SP3-LTSS kernel-obs-build 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server 15 SP3-LTSS kernel-preempt 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server 15 SP3-LTSS kernel-source 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server 15 SP3-LTSS kernel-syms 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server 15 SP3-LTSS kernel-zfcpdump 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 kernel-default 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 kernel-default-base 0 5.3.18-150300.59.158.1.150300.18.92.5
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 kernel-docs 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 kernel-obs-build 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 kernel-preempt 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 kernel-source 0 5.3.18-150300.59.158.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 kernel-syms 0 5.3.18-150300.59.158.1
Ubuntu:14.04:LTS linux 0 3.11.0-12.19
Ubuntu:14.04:LTS linux-aws 0 4.4.0-1002.2
Ubuntu:14.04:LTS linux-azure 0 4.15.0-1023.24~14.04.1
Ubuntu:14.04:LTS linux-lts-xenial 0 4.4.0-13.29~14.04.1
Ubuntu:16.04:LTS linux-hwe-edge 0 No fix
Ubuntu:18.04:LTS linux 0 4.15.0-151.157
Ubuntu:18.04:LTS linux-aws 0 4.15.0-1109.116
Ubuntu:18.04:LTS linux-aws-5.0 0 No fix
Ubuntu:18.04:LTS linux-aws-5.3 0 No fix
Ubuntu:18.04:LTS linux-aws-5.4 0 5.4.0-1051.53~18.04.1
Ubuntu:18.04:LTS linux-azure 0 No fix
Ubuntu:18.04:LTS linux-azure-4.15 0 4.15.0-1121.134
Ubuntu:18.04:LTS linux-azure-5.3 0 No fix
Ubuntu:18.04:LTS linux-azure-5.4 0 5.4.0-1051.53~18.04.1
Ubuntu:18.04:LTS linux-azure-edge 0 No fix
Ubuntu:18.04:LTS linux-gcp 0 No fix
Ubuntu:18.04:LTS linux-gcp-4.15 0 4.15.0-1106.120
Ubuntu:18.04:LTS linux-gcp-5.3 0 No fix
Ubuntu:18.04:LTS linux-gcp-5.4 0 5.4.0-1046.49~18.04.1
Ubuntu:18.04:LTS linux-gke-4.15 0 No fix
Ubuntu:18.04:LTS linux-gke-5.4 0 No fix
Ubuntu:18.04:LTS linux-gkeop-5.4 0 No fix
Ubuntu:18.04:LTS linux-hwe 0 No fix
Ubuntu:18.04:LTS linux-hwe-5.4 0 5.4.0-77.86~18.04.1
Ubuntu:18.04:LTS linux-hwe-edge 0 5.0.0-15.16~18.04.1
Ubuntu:18.04:LTS linux-ibm-5.4 0 5.4.0-1010.11~18.04.2
Ubuntu:18.04:LTS linux-kvm 0 4.15.0-1097.99
Ubuntu:18.04:LTS linux-oem 0 No fix
Ubuntu:18.04:LTS linux-oracle 0 4.15.0-1078.86
Ubuntu:18.04:LTS linux-oracle-5.0 0 No fix
Ubuntu:18.04:LTS linux-oracle-5.3 0 No fix
Ubuntu:18.04:LTS linux-oracle-5.4 0 5.4.0-1048.52~18.04.1
Ubuntu:18.04:LTS linux-raspi-5.4 0 5.4.0-1038.41~18.04.1
Ubuntu:20.04:LTS linux 0 No fix
Ubuntu:20.04:LTS linux 0 5.4.0-77.86
Ubuntu:20.04:LTS linux-aws 0 No fix
Ubuntu:20.04:LTS linux-aws 0 5.4.0-1051.53
Ubuntu:20.04:LTS linux-aws-5.11 0 No fix
Ubuntu:20.04:LTS linux-aws-5.13 0 No fix
Ubuntu:20.04:LTS linux-aws-5.15 0 5.15.0-1014.18~20.04.1
Ubuntu:20.04:LTS linux-aws-5.8 0 No fix
Ubuntu:20.04:LTS linux-azure 0 No fix
Ubuntu:20.04:LTS linux-azure 0 5.4.0-1051.53
Ubuntu:20.04:LTS linux-azure-5.11 0 No fix
Ubuntu:20.04:LTS linux-azure-5.13 0 No fix
Ubuntu:20.04:LTS linux-azure-5.15 0 5.15.0-1007.8~20.04.1
Ubuntu:20.04:LTS linux-azure-5.8 0 No fix
Ubuntu:20.04:LTS linux-azure-fde 0 No fix
Ubuntu:20.04:LTS linux-azure-fde-5.15 0 5.15.0-1019.24~20.04.1.1
Ubuntu:20.04:LTS linux-bluefield 0 No fix
Ubuntu:20.04:LTS linux-bluefield 0 5.4.0-1013.16
Ubuntu:20.04:LTS linux-gcp 0 No fix
Ubuntu:20.04:LTS linux-gcp 0 5.4.0-1046.49
Ubuntu:20.04:LTS linux-gcp-5.11 0 No fix
Ubuntu:20.04:LTS linux-gcp-5.13 0 No fix
Ubuntu:20.04:LTS linux-gcp-5.15 0 5.15.0-1006.9~20.04.1
Ubuntu:20.04:LTS linux-gcp-5.8 0 No fix
Ubuntu:20.04:LTS linux-gke 0 No fix
Ubuntu:20.04:LTS linux-gke-5.15 0 No fix
Ubuntu:20.04:LTS linux-gkeop 0 No fix
Ubuntu:20.04:LTS linux-gkeop 0 5.4.0-1018.19
Ubuntu:20.04:LTS linux-gkeop-5.15 0 5.15.0-1003.5~20.04.2
Ubuntu:20.04:LTS linux-hwe-5.11 0 No fix
Ubuntu:20.04:LTS linux-hwe-5.13 0 No fix
Ubuntu:20.04:LTS linux-hwe-5.15 0 5.15.0-33.34~20.04.1
Ubuntu:20.04:LTS linux-hwe-5.8 0 No fix
Ubuntu:20.04:LTS linux-ibm 0 5.4.0-1003.4
Ubuntu:20.04:LTS linux-ibm-5.15 0 5.15.0-1033.36~20.04.1
Ubuntu:20.04:LTS linux-intel-5.13 0 No fix
Ubuntu:20.04:LTS linux-intel-iotg-5.15 0 5.15.0-1003.5~20.04.1
Ubuntu:20.04:LTS linux-iot 0 5.4.0-1001.3
Ubuntu:20.04:LTS linux-kvm 0 No fix
Ubuntu:20.04:LTS linux-kvm 0 5.4.0-1041.42
Ubuntu:20.04:LTS linux-lowlatency-hwe-5.15 0 5.15.0-33.34~20.04.1
Ubuntu:20.04:LTS linux-oem-5.10 0 No fix
Ubuntu:20.04:LTS linux-oem-5.13 0 No fix
Ubuntu:20.04:LTS linux-oem-5.14 0 No fix
Ubuntu:20.04:LTS linux-oem-5.6 0 No fix
Ubuntu:20.04:LTS linux-oracle 0 No fix
Ubuntu:20.04:LTS linux-oracle 0 5.4.0-1048.52
Ubuntu:20.04:LTS linux-oracle-5.11 0 No fix
Ubuntu:20.04:LTS linux-oracle-5.13 0 No fix
Ubuntu:20.04:LTS linux-oracle-5.15 0 5.15.0-1007.9~20.04.1
Ubuntu:20.04:LTS linux-oracle-5.8 0 No fix
Ubuntu:20.04:LTS linux-raspi 0 No fix
Ubuntu:20.04:LTS linux-raspi 0 5.4.0-1038.41
Ubuntu:20.04:LTS linux-raspi2 0 No fix
Ubuntu:20.04:LTS linux-riscv 0 No fix
Ubuntu:20.04:LTS linux-riscv-5.11 0 No fix
Ubuntu:20.04:LTS linux-riscv-5.15 0 5.15.0-1015.17~20.04.1
Ubuntu:20.04:LTS linux-riscv-5.8 0 No fix
Ubuntu:20.04:LTS linux-xilinx-zynqmp 0 5.4.0-1020.24
Ubuntu:22.04:LTS linux 0 5.13.0-19.19
Ubuntu:22.04:LTS linux-allwinner-5.19 0 No fix
Ubuntu:22.04:LTS linux-aws 0 5.13.0-1005.6
Ubuntu:22.04:LTS linux-aws-5.19 0 No fix
Ubuntu:22.04:LTS linux-aws-6.2 0 No fix
Ubuntu:22.04:LTS linux-aws-6.5 0 6.5.0-1008.8~22.04.1
Ubuntu:22.04:LTS linux-aws-6.8 0 6.8.0-1009.9~22.04.2
Ubuntu:22.04:LTS linux-azure 0 5.13.0-1006.7
Ubuntu:22.04:LTS linux-azure-5.19 0 No fix
Ubuntu:22.04:LTS linux-azure-6.2 0 No fix
Ubuntu:22.04:LTS linux-azure-6.5 0 6.5.0-1007.7~22.04.1
Ubuntu:22.04:LTS linux-azure-6.8 0 6.8.0-1008.8~22.04.1
Ubuntu:22.04:LTS linux-azure-fde 0 5.15.0-1019.24.1
Ubuntu:22.04:LTS linux-azure-fde-5.19 0 No fix
Ubuntu:22.04:LTS linux-azure-fde-6.2 0 No fix
Ubuntu:22.04:LTS linux-gcp 0 5.13.0-1005.6
Ubuntu:22.04:LTS linux-gcp-5.19 0 No fix
Ubuntu:22.04:LTS linux-gcp-6.2 0 No fix
Ubuntu:22.04:LTS linux-gcp-6.5 0 6.5.0-1010.10~22.04.3
Ubuntu:22.04:LTS linux-gcp-6.8 0 6.8.0-1010.11~22.04.1
Ubuntu:22.04:LTS linux-gke 0 5.15.0-1002.2
Ubuntu:22.04:LTS linux-gkeop 0 5.15.0-1001.2
Ubuntu:22.04:LTS linux-hwe-5.19 0 No fix
Ubuntu:22.04:LTS linux-hwe-6.2 0 No fix
Ubuntu:22.04:LTS linux-hwe-6.5 0 6.5.0-14.14~22.04.1
Ubuntu:22.04:LTS linux-hwe-6.8 0 6.8.0-38.38~22.04.1
Ubuntu:22.04:LTS linux-ibm 0 5.15.0-1002.2
Ubuntu:22.04:LTS linux-intel-iot-realtime 0 No fix
Ubuntu:22.04:LTS linux-intel-iot-realtime 0 5.15.0-1021.26
Ubuntu:22.04:LTS linux-intel-iotg 0 5.15.0-1004.6
Ubuntu:22.04:LTS linux-kvm 0 5.13.0-1004.4
Ubuntu:22.04:LTS linux-lowlatency 0 5.15.0-22.22
Ubuntu:22.04:LTS linux-lowlatency-hwe-5.19 0 No fix
Ubuntu:22.04:LTS linux-lowlatency-hwe-6.2 0 No fix
Ubuntu:22.04:LTS linux-lowlatency-hwe-6.5 0 6.5.0-14.14.1~22.04.1
Ubuntu:22.04:LTS linux-lowlatency-hwe-6.8 0 6.8.0-38.38.1~22.04.2
Ubuntu:22.04:LTS linux-nvidia 0 5.15.0-1005.5
Ubuntu:22.04:LTS linux-nvidia-6.2 0 No fix
Ubuntu:22.04:LTS linux-nvidia-6.5 0 6.5.0-1004.4
Ubuntu:22.04:LTS linux-nvidia-6.8 0 6.8.0-1008.8~22.04.1
Ubuntu:22.04:LTS linux-oem-5.17 0 No fix
Ubuntu:22.04:LTS linux-oem-6.0 0 No fix
Ubuntu:22.04:LTS linux-oem-6.1 0 No fix
Ubuntu:22.04:LTS linux-oem-6.5 0 6.5.0-1003.3
Ubuntu:22.04:LTS linux-oracle 0 5.13.0-1008.10
Ubuntu:22.04:LTS linux-oracle-6.5 0 6.5.0-1013.13~22.04.4
Ubuntu:22.04:LTS linux-oracle-6.8 0 6.8.0-1006.6~22.04.3
Ubuntu:22.04:LTS linux-raspi 0 5.13.0-1008.9
Ubuntu:22.04:LTS linux-realtime 0 No fix
Ubuntu:22.04:LTS linux-riscv 0 No fix
Ubuntu:22.04:LTS linux-riscv-5.19 0 No fix
Ubuntu:22.04:LTS linux-riscv-6.5 0 6.5.0-17.17.1.1~22.04.1
Ubuntu:22.04:LTS linux-riscv-6.8 0 6.8.0-38.38.1~22.04.1
Ubuntu:22.04:LTS linux-starfive-5.19 0 No fix
Ubuntu:22.04:LTS linux-starfive-6.2 0 No fix
Ubuntu:22.04:LTS linux-starfive-6.5 0 6.5.0-1007.8~22.04.1
Ubuntu:22.04:LTS linux-xilinx-zynqmp 0 5.15.0-1022.26
Ubuntu:22.04:LTS:for:NVIDIA:BlueField linux-bluefield 0 5.15.0-1011.13
Ubuntu:24.04:LTS linux 0 6.5.0-9.9
Ubuntu:24.04:LTS linux-aws 0 6.5.0-1008.8
Ubuntu:24.04:LTS linux-azure 0 6.5.0-1007.7
Ubuntu:24.04:LTS linux-gcp 0 6.5.0-1007.7

Related vulnerabilities