Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-40906 Overview
CVE-2024-40906 is a use-after-free vulnerability [CWE-416] in the Linux kernel's Mellanox mlx5 network driver. The flaw resides in the driver removal path: when teardown_hca fails, mlx5 skips stopping the health timer and proceeds with teardown. The timer later invokes poll_health against freed hardware resources, triggering a page fault and kernel Oops.
The bug affects systems using Mellanox ConnectX adapters managed by mlx5_core. Successful triggering produces a kernel crash and may be leveraged for local privilege escalation on affected hosts.
Critical Impact
A local attacker or faulty teardown sequence can cause a kernel-level use-after-free in mlx5_core, resulting in denial of service and potential memory corruption on hosts with Mellanox NICs.
Affected Products
- Linux kernel stable branches prior to the fix commits
- Linux kernel 6.10-rc1 and 6.10-rc2
- Systems using the mlx5_core driver with Mellanox ConnectX adapters
Discovery Timeline
- 2024-07-12 - CVE-2024-40906 published to NVD
- 2025-01 - Debian LTS security announcement issued
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-40906
Vulnerability Analysis
The vulnerability is a use-after-free in the mlx5 network driver's removal path. During driver unload, mlx5_function_close calls teardown_hca to release firmware context on the device. If the firmware command times out, as shown in the reported trace with TEARDOWN_HCA(0x103) timeout, the function logs tear_down_hca failed, skip cleanup and continues the removal sequence.
The original code conditionally stopped the health monitor timer based on successful teardown. When teardown failed, the health timer continued running. Subsequent removal steps freed MMIO mapping and driver resources, leaving the timer with dangling pointers.
When the timer next fires, poll_health calls mlx5_health_check_fatal_sensors, which invokes ioread32be against unmapped memory. This produces the page fault at ffffa26487064230 captured in the Oops. The fault occurs in interrupt context (sysvec_apic_timer_interrupt), making recovery impossible and crashing the host.
Root Cause
The root cause is improper ordering of teardown operations in mlx5_function_close. The health timer must be stopped unconditionally before freeing hardware resources. Treating the health monitor as dependent on teardown_hca success left a live timer referencing deallocated structures [CWE-416].
Attack Vector
The attack vector is local. Triggering requires conditions that cause TEARDOWN_HCA to time out during driver removal, such as firmware hangs, forced driver unload under load, or hot-unplug scenarios. A local user with privileges to unload or rebind the mlx5_core driver can create conditions that reach the vulnerable path. The vulnerability does not require network traffic.
No verified public exploit code is available. The reproducer is the kernel Oops captured in the upstream commit message.
Detection Methods for CVE-2024-40906
Indicators of Compromise
- Kernel log entries containing TEARDOWN_HCA followed by timeout. Will cause a leak of a command resource
- Messages reading tear_down_hca failed, skip cleanup from mlx5_function_close
- Kernel Oops referencing poll_health, mlx5_health_check_fatal_sensors, or ioread32be in the call trace
- Unexpected host crashes shortly after mlx5_core driver unload or device rebind events
Detection Strategies
- Monitor dmesg and /var/log/kern.log for mlx5_core teardown errors and page fault Oops signatures
- Correlate node reboots with preceding driver management actions on Mellanox interfaces
- Inventory kernel versions across the fleet and flag hosts running vulnerable mlx5_core builds
Monitoring Recommendations
- Forward kernel ring buffer logs to a centralized SIEM for pattern matching on mlx5 teardown failures
- Alert on repeated modprobe -r mlx5_core or driver rebind operations on production hosts
- Track firmware versions on ConnectX adapters, since firmware hangs are the trigger for the vulnerable code path
How to Mitigate CVE-2024-40906
Immediate Actions Required
- Apply the stable kernel updates referenced in the upstream commits to all hosts using mlx5_core
- On Debian systems, install the kernel package shipped in the Debian LTS Security Announcement
- Restrict the ability to unload or rebind kernel modules to privileged administrators only
- Validate ConnectX firmware is current to reduce TEARDOWN_HCA timeout conditions
Patch Information
The fix changes mlx5_function_close to always stop the health monitor during driver removal, regardless of teardown_hca return status. Patches are available in the upstream Linux stable tree:
Workarounds
- Avoid unloading or rebinding mlx5_core on production hosts until the patched kernel is deployed
- Blacklist non-essential operations that trigger driver teardown, such as automated hot-plug scripts targeting Mellanox adapters
- If driver removal is required, confirm no firmware command timeouts are present in dmesg before proceeding
# Verify kernel version and mlx5_core module details
uname -r
modinfo mlx5_core | grep -E '^(version|srcversion|filename):'
# Check for prior mlx5 teardown errors in the kernel log
dmesg | grep -iE 'mlx5|TEARDOWN_HCA|poll_health'
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

