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-50059 Overview
CVE-2024-50059 is a use-after-free vulnerability [CWE-416] in the Linux kernel's ntb_hw_switchtec driver. The flaw resides in the switchtec_ntb_remove function and is triggered by a race condition between module removal and the check_link_status_work deferred work handler. When switchtec_ntb_remove frees the sndev structure through kfree(sndev) while the bound work item is still executing, the kernel accesses freed memory.
Exploitation requires local access and elevated privileges to unload the kernel module, but successful exploitation can lead to kernel memory corruption, privilege escalation, or denial of service on affected systems.
Critical Impact
Race condition during module removal can corrupt kernel memory, enabling local privilege escalation or system crash on hosts using Microsemi Switchtec NTB hardware.
Affected Products
- Linux Kernel (multiple stable branches prior to the fix commits)
- Debian LTS distributions (addressed in January and March 2025 advisories)
- Systems using the ntb_hw_switchtec driver with Microsemi Switchtec PCIe switches
Discovery Timeline
- 2024-10-21 - CVE-2024-50059 published to NVD
- 2026-08-04 - Last updated in NVD database
Technical Details for CVE-2024-50059
Vulnerability Analysis
The vulnerability affects the Non-Transparent Bridge (NTB) driver for Microsemi Switchtec PCIe switches. During driver initialization, switchtec_ntb_add calls switchtec_ntb_init_sndev, which binds &sndev->check_link_status_work to the check_link_status_work handler. The function switchtec_ntb_link_notification can then schedule this work item on the kernel workqueue.
When the module is unloaded, switchtec_ntb_remove calls kfree(sndev) to release the device structure. If the scheduled check_link_status_work executes concurrently on another CPU, it dereferences fields such as sndev->link_force_down on memory that has already been freed. This produces a classic use-after-free condition on kernel heap memory.
Root Cause
The root cause is missing synchronization between resource teardown and asynchronous work execution. The driver releases the sndev allocation without first canceling or flushing the pending check_link_status_work work item. The upstream fix adds a cancellation step to ensure the work handler cannot run after kfree(sndev) completes.
Attack Vector
Exploitation requires local access with sufficient privileges to trigger module removal, typically CAP_SYS_MODULE. An attacker must also influence timing so that check_link_status_work executes during the narrow window between work scheduling and the kfree(sndev) call in switchtec_ntb_remove. Successful exploitation can corrupt kernel data structures, enabling escalation to full kernel code execution or causing a system panic.
For technical details, refer to the upstream fixes in Kernel Commit 177925d and Kernel Commit fa840ba.
Detection Methods for CVE-2024-50059
Indicators of Compromise
- Kernel oops or panic entries in dmesg referencing ntb_hw_switchtec, check_link_status_work, or switchtec_ntb_remove
- KASAN (Kernel Address Sanitizer) reports flagging use-after-free in the Switchtec NTB driver
- Unexpected module unload events for ntb_hw_switchtec recorded in audit logs
Detection Strategies
- Enable KASAN on test and pre-production kernels to catch use-after-free conditions in the NTB driver path
- Monitor /var/log/kern.log and journald output for stack traces involving switchtec_ntb_remove or workqueue handlers tied to NTB devices
- Compare running kernel versions against the fixed commits listed in the vendor advisories to identify unpatched hosts
Monitoring Recommendations
- Audit init_module and delete_module syscalls through the Linux audit subsystem to detect unauthorized loading or unloading of ntb_hw_switchtec
- Track processes invoking rmmod or modprobe -r against the Switchtec driver on hosts with PCIe NTB hardware
- Alert on kernel crash dumps collected by kdump that reference NTB driver symbols
How to Mitigate CVE-2024-50059
Immediate Actions Required
- Apply the stable kernel updates referenced in the upstream commits to all affected systems
- Restrict CAP_SYS_MODULE to trusted administrative accounts to prevent arbitrary module unloading
- On hosts that do not use Switchtec NTB hardware, blacklist the ntb_hw_switchtec module to eliminate the attack surface
Patch Information
The fix ensures the check_link_status_work work item is canceled before switchtec_ntb_remove releases the sndev allocation. The patch is included in multiple stable kernel branches via commits 177925d, 3ae45be, 92728fc, b650189, e51aded, and fa840ba. Debian users should consult the Debian LTS Advisory January 2025 and Debian LTS Advisory March 2025.
Workarounds
- Blacklist the ntb_hw_switchtec module on systems that do not require NTB functionality by adding blacklist ntb_hw_switchtec to /etc/modprobe.d/blacklist.conf
- Enforce module signing and lockdown mode to prevent untrusted users from loading or unloading kernel modules
- Limit shell access on affected hosts to administrators, since exploitation requires local privileged access
# Blacklist the vulnerable driver on hosts without Switchtec NTB hardware
echo "blacklist ntb_hw_switchtec" | sudo tee /etc/modprobe.d/disable-ntb-switchtec.conf
sudo depmod -a
sudo update-initramfs -u
# Verify the module is not loaded after reboot
lsmod | grep ntb_hw_switchtec
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

