From: Guo DaXing <redacted>
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.
Signed-off-by: Guo DaXing <redacted>
---
net/smc/af_smc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: Tony Lu <tonylu@linux.alibaba.com> Date: 2021-11-22 03:19:23
On Sat, Nov 20, 2021 at 03:54:51PM +0800, Daxing Guo wrote:
From: Guo DaXing <redacted>
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.
Hi Guo,
This indeed seems to be an issue. When listen fails, the original
clcsock's sk_data_ready overwrites by smc_clcsock_data_ready and can't
be recovered. I will also test it in my environment, thanks.
Cheers,
Tony Lu
From: Guo DaXing <redacted>
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.
Signed-off-by: Guo DaXing <redacted>
---
Thanks for your patch, I will pick it up and submit it to the net tree.
From: Tony Lu <tonylu@linux.alibaba.com> Date: 2021-11-22 08:37:50
On Sat, Nov 20, 2021 at 03:54:51PM +0800, Daxing Guo wrote:
From: Guo DaXing <redacted>
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.
Signed-off-by: Guo DaXing <redacted>
It works in my testing environment, thanks.
Acked-by: Tony Lu <tonylu@linux.alibaba.com>