android_kernel_xiaomi_sm8350/net/smc
D. Wythe f8065cde49 net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT
[ Upstream commit 5211c9729484c923f8d2e06bd29f9322cc42bb8f ]

Considering scenario:

				smc_cdc_rx_handler
__smc_release
				sock_set_flag
smc_close_active()
sock_set_flag

__set_bit(DEAD)			__set_bit(DONE)

Dues to __set_bit is not atomic, the DEAD or DONE might be lost.
if the DEAD flag lost, the state SMC_CLOSED  will be never be reached
in smc_close_passive_work:

if (sock_flag(sk, SOCK_DEAD) &&
	smc_close_sent_any_close(conn)) {
	sk->sk_state = SMC_CLOSED;
} else {
	/* just shutdown, but not yet closed locally */
	sk->sk_state = SMC_APPFINCLOSEWAIT;
}

Replace sock_set_flags or __set_bit to set_bit will fix this problem.
Since set_bit is atomic.

Fixes: b38d732477 ("smc: socket closing and linkgroup cleanup")
Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 10:30:16 +01:00
..
af_smc.c net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT 2023-11-20 10:30:16 +01:00
Kconfig
Makefile
smc_cdc.c net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT 2023-11-20 10:30:16 +01:00
smc_cdc.h
smc_clc.c
smc_clc.h
smc_close.c net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT 2023-11-20 10:30:16 +01:00
smc_close.h
smc_core.c
smc_core.h
smc_diag.c
smc_ib.c
smc_ib.h
smc_ism.c
smc_ism.h
smc_llc.c
smc_llc.h
smc_netns.h
smc_pnet.c
smc_pnet.h
smc_rx.c
smc_rx.h
smc_tx.c
smc_tx.h
smc_wr.c
smc_wr.h
smc.h net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT 2023-11-20 10:30:16 +01:00