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-56640 Overview
CVE-2024-56640 is a use-after-free vulnerability [CWE-416] in the Linux kernel's Shared Memory Communications (SMC) protocol implementation. The flaw resides in the net/smc subsystem, specifically in how Link Group (LGR) and link reference counts are managed during server listening operations. The smc_conn_free() function can be invoked multiple times on the same connection because paths originating from smc_listen_work() lack socket lock protection. This leads to premature reference count decrement, triggering early resource teardown and unsafe memory access.
Critical Impact
Local attackers with low privileges can trigger kernel memory corruption through the SMC socket interface, potentially leading to privilege escalation, kernel panic, or arbitrary code execution in kernel context.
Affected Products
- Linux Kernel (multiple stable branches prior to patches)
- Linux Kernel 6.13-rc1
- Debian Linux (addressed in Debian LTS March 2025 advisory)
Discovery Timeline
- 2024-12-27 - CVE CVE-2024-56640 published to NVD
- 2026-08-04 - Last updated in NVD database
Technical Details for CVE-2024-56640
Vulnerability Analysis
The vulnerability affects the Shared Memory Communications (SMC) protocol stack in the Linux kernel. SMC relies on reference-counted LGR and link structures to manage shared memory connections between endpoints. When a reference count reaches zero prematurely, the kernel enters the clear process and releases backing memory while other code paths still hold stale pointers.
The kernel emits refcount warnings such as refcount_t: addition on 0; use-after-free from __smc_lgr_terminate.part.45 and refcount_t: underflow; use-after-free from smcr_link_put. Both traces originate from the SMC workqueue handlers smc_lgr_terminate_work and smc_listen_work.
Root Cause
The root cause is missing socket lock serialization in the server listening path. Operations invoked under lock_sock(sk) call smc_conn_free(), which in turn calls smcr_link_put(). In parallel, smc_listen_work can execute smc_conn_abort(), which also calls smc_conn_free() and performs a duplicate smcr_link_put(). The two code paths race because smc_listen_work does not acquire the socket lock before freeing the connection.
Attack Vector
Exploitation requires local access and the ability to open SMC sockets. An attacker triggers concurrent connection operations against a listening SMC socket to force the race between smc_listen_work and socket-locked teardown paths. Repeated reference count decrements free the LGR or link structure while other kernel contexts continue to reference it, producing a classic use-after-free condition exploitable for memory corruption or privilege escalation.
No public proof-of-concept code is available. The upstream fix adds socket lock protection in smc_listen_work() to serialize it with other connection operations. Refer to the kernel commits in the vendor advisories section for the exact patch content.
Detection Methods for CVE-2024-56640
Indicators of Compromise
- Kernel log entries containing refcount_t: addition on 0; use-after-free or refcount_t: underflow; use-after-free originating from refcount_warn_saturate.
- Call traces referencing smc_lgr_terminate_work, smcr_link_put, smc_conn_free, or smc_listen_work in the [smc] module.
- Unexpected kernel panics or oops events on hosts with SMC enabled during high connection churn.
Detection Strategies
- Enable kernel refcount debugging (CONFIG_REFCOUNT_FULL) and ship dmesg output to a central logging platform to detect refcount saturation warnings.
- Monitor loaded kernel modules for the presence of smc and smc_diag on systems that do not require SMC.
- Audit systems for processes creating AF_SMC sockets using eBPF or auditd rules.
Monitoring Recommendations
- Forward kernel ring buffer and /var/log/kern.log entries to a centralized SIEM for correlation.
- Alert on repeated SMC workqueue warnings or crashes within short time windows on the same host.
- Track kernel version inventory and flag hosts running vulnerable builds predating the fix commits.
How to Mitigate CVE-2024-56640
Immediate Actions Required
- Apply the upstream Linux kernel patches referenced in the vendor advisories as soon as stable builds are available for your distribution.
- Inventory all Linux hosts using the SMC protocol, including mainframe-adjacent systems and RDMA-capable environments where SMC-R is deployed.
- Restrict CAP_NET_RAW and SMC socket creation to trusted service accounts to reduce the local attack surface.
Patch Information
The fix adds socket lock protection in the smc_listen_work() code path to serialize connection teardown. Patches are available in the following upstream commits: Kernel Git Commit 0cf5985, Kernel Git Commit 2c7f14e, Kernel Git Commit 673d606, Kernel Git Commit 6f0ae06, and Kernel Git Commit f502a88. Debian users should consult the Debian LTS Announcement March 2025.
Workarounds
- Blacklist the smc and smc_diag modules on systems that do not require SMC functionality, preventing module autoload.
- Use SELinux, AppArmor, or seccomp profiles to deny socket(AF_SMC, ...) creation for unprivileged users.
- Reduce exposure by disabling SMC-R and SMC-D on hosts lacking a RDMA or ISM device requirement.
# Blacklist the SMC kernel modules to prevent loading
echo 'blacklist smc' | sudo tee /etc/modprobe.d/blacklist-smc.conf
echo 'blacklist smc_diag' | sudo tee -a /etc/modprobe.d/blacklist-smc.conf
# Verify the modules are not currently loaded
lsmod | grep -E '^smc'
# If loaded, remove them (requires no active SMC connections)
sudo modprobe -r smc_diag smc
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

