net/smc: fix NULL dereference and UAF in smc_tcp_syn_recv_sock()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 8270d9c21041470f58348248b9d9dcf3bf79592e · < 1fab5ece76fb42a761178dcd0ebcbf578377b0dd| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
net/smc: fix NULL dereference and UAF in smc_tcp_syn_recv_sock()
Syzkaller reported a panic in smc_tcp_syn_recv_sock() [1].
smc_tcp_syn_recv_sock() is called in the TCP receive path (softirq) via icsk_af_ops->syn_recv_sock on the clcsock (TCP listening socket). It reads sk_user_data to get the smc_sock pointer. However, when the SMC listen socket is being closed concurrently, smc_close_active() sets clcsock->sk_user_data to NULL under sk_callback_lock, and then the smc_sock itself can be freed via sock_put() in smc_release().
This leads to two issues:
1) NULL pointer dereference: sk_user_data is NULL when accessed. 2) Use-after-free: sk_user_data is read as non-NULL, but the smc_sock is freed before its fields (e.g., queued_smc_hs, ori_af_ops) are accessed.
The race window looks like this (the syzkaller crash [1] triggers via the SYN cookie path: tcp_get_cookie_sock() -> smc_tcp_syn_recv_sock(), but the normal tcp_check_req() path has the same race):
CPU A (softirq) CPU B (process ctx)
From the CVE record · Linux
The Linux kernel’s net/smc code can dereference a NULL or freed SMC socket when a listening socket closes concurrently with TCP handshake processing. A network-triggered handshake can hit this race and crash the kernel; the input does not specify authentication or user-interaction requirements.
Engineers running Linux kernels with SMC support should check whether their kernel includes the net/smc fix; affected versions are not specified.