linux-stable/net/smc
D. Wythe 5211c97294 net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT
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>
2023-11-06 10:01:07 +00:00
..
af_smc.c net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT 2023-11-06 10:01:07 +00:00
Kconfig net/smc: Fix dependency of SMC on ISM 2023-10-10 11:51:41 +02:00
Makefile
smc.h net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT 2023-11-06 10:01:07 +00:00
smc_cdc.c net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT 2023-11-06 10:01:07 +00:00
smc_cdc.h
smc_clc.c net/smc: support max links per lgr negotiation in clc handshake 2023-08-19 12:46:53 +01:00
smc_clc.h net/smc: support max links per lgr negotiation in clc handshake 2023-08-19 12:46:53 +01:00
smc_close.c net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT 2023-11-06 10:01:07 +00:00
smc_close.h
smc_core.c net/smc: use smc_lgr_list.lock to protect smc_lgr_list.list iterate in smcr_port_add 2023-09-10 19:31:42 +01:00
smc_core.h net/smc: support max links per lgr negotiation in clc handshake 2023-08-19 12:46:53 +01:00
smc_diag.c net/smc: Separate SMC-D and ISM APIs 2023-01-25 09:46:48 +00:00
smc_ib.c net/smc: fix smc clc failed issue when netdevice not in init_net 2023-10-13 16:52:02 -07:00
smc_ib.h net/smc: fix smc clc failed issue when netdevice not in init_net 2023-10-13 16:52:02 -07:00
smc_ism.c net/smc: Introduce explicit check for v2 support 2023-03-15 08:18:35 +00:00
smc_ism.h net/smc: Register SMC-D as ISM client 2023-01-25 09:46:48 +00:00
smc_llc.c net/smc: support max links per lgr negotiation in clc handshake 2023-08-19 12:46:53 +01:00
smc_llc.h net/smc: Introduce a specific sysctl for TEST_LINK time 2022-09-22 12:58:21 +02:00
smc_netlink.c genetlink: start to validate reserved header bytes 2022-08-29 12:47:15 +01:00
smc_netlink.h
smc_netns.h
smc_pnet.c net/smc: De-tangle ism and smc device initialization 2023-01-25 09:46:49 +00:00
smc_pnet.h
smc_rx.c net: deal with most data-races in sk_wait_event() 2023-05-10 10:03:32 +01:00
smc_rx.h
smc_stats.c smc: Drop smc_sendpage() in favour of smc_sendmsg() + MSG_SPLICE_PAGES 2023-06-24 15:50:12 -07:00
smc_stats.h net/smc: Fix pos miscalculation in statistics 2023-10-11 10:36:35 +01:00
smc_sysctl.c sysctl-6.6-rc1 2023-08-29 17:39:15 -07:00
smc_sysctl.h
smc_tracepoint.c
smc_tracepoint.h
smc_tx.c smc: Drop smc_sendpage() in favour of smc_sendmsg() + MSG_SPLICE_PAGES 2023-06-24 15:50:12 -07:00
smc_tx.h smc: Drop smc_sendpage() in favour of smc_sendmsg() + MSG_SPLICE_PAGES 2023-06-24 15:50:12 -07:00
smc_wr.c net/smc: Use percpu ref for wr tx reference 2023-03-17 08:59:01 +00:00
smc_wr.h net/smc: Use percpu ref for wr tx reference 2023-03-17 08:59:01 +00:00