Skip to content

Commit 9ebb0c4

Browse files
Guo DaXingkuba-moo
authored andcommitted
net/smc: Fix loop in smc_listen
The kernel_listen function in smc_listen will fail when all the available ports are occupied. At this point smc->clcsock->sk->sk_data_ready has been changed to smc_clcsock_data_ready. When we call smc_listen again, now both smc->clcsock->sk->sk_data_ready and smc->clcsk_data_ready point to the smc_clcsock_data_ready function. The smc_clcsock_data_ready() function calls lsmc->clcsk_data_ready which now points to itself resulting in an infinite loop. This patch restores smc->clcsock->sk->sk_data_ready with the old value. Fixes: a60a2b1 ("net/smc: reduce active tcp_listen workers") Signed-off-by: Guo DaXing <guodaxing@huawei.com> Acked-by: Tony Lu <tonylu@linux.alibaba.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 587acad commit 9ebb0c4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/smc/af_smc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,8 +2134,10 @@ static int smc_listen(struct socket *sock, int backlog)
21342134
smc->clcsock->sk->sk_user_data =
21352135
(void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY);
21362136
rc = kernel_listen(smc->clcsock, backlog);
2137-
if (rc)
2137+
if (rc) {
2138+
smc->clcsock->sk->sk_data_ready = smc->clcsk_data_ready;
21382139
goto out;
2140+
}
21392141
sk->sk_max_ack_backlog = backlog;
21402142
sk->sk_ack_backlog = 0;
21412143
sk->sk_state = SMC_LISTEN;

0 commit comments

Comments
 (0)