CRITICAL
smb SMBDirect Double-Free
CVE-2026-31609
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
KernelScan AI9.8CRITICAL
01Description
In the Linux kernel, the following vulnerability has been resolved: smb: client: avoid double-free in smbd_free_send_io() after smbd_send_batch_flush() smbd_send_batch_flush() already calls smbd_free_send_io(), so we should not call it again after smbd_post_send() moved it to the batch list.
02KernelScan AI Analysis
Risk summary
A critical double-free vulnerability in the Linux SMB client's SMB Direct implementation could allow attackers to cause system crashes or potentially achieve code execution. When SMB clients connect to malicious servers or experience specific network conditions during SMB Direct operations, the kernel may free the same memory twice, leading to heap corruption. This affects systems using SMB shares over RDMA networks and could be exploited by malicious SMB servers to compromise client systems.
Vulnerability analysis
Root Cause: In the SMB client's SMB Direct implementation, the smbd_post_send_iter() function has a double-free vulnerability. When smbd_post_send() successfully moves a request to a batch list, the code path continues to call smbd_free_send_io() on error conditions, even though smbd_send_batch_flush() has already freed the same request structure. This occurs because the error handling logic doesn't account for the ownership transfer that happens when the request is moved to the batch.
Attack Surface: This vulnerability affects SMB client connections using SMB Direct (RDMA) transport. It requires an active SMB connection to a server and can be triggered during normal SMB operations when batch flushing fails. The attack surface is network-based but requires legitimate SMB client usage, making it exploitable by malicious SMB servers or through network manipulation during SMB Direct operations.
Fix Mechanism: The patch adds a new error label 'err_flush' and restructures the error handling flow. After smbd_post_send() succeeds (moving the request to batch), if smbd_send_batch_flush() fails, the code jumps to 'err_flush' which skips the smbd_free_send_io() call. A comment is added to clarify that once the request is moved to batch, it should not be freed explicitly. This prevents the double-free by ensuring the request is only freed once.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 6.18 | 6.18.24 | a9940dcbe5cb |
| 6.19 | 6.19.14 | 22b7c1c619d8 |
| 7.0 | 7.0.1 | f9a162c2bbcd |
| mainline | 7.1-rc1 | 27b7c3e91621 |