linux-stable/net/smc
Karsten Graul f15f7716b0 net/smc: fix wait on already cleared link
[ Upstream commit 8f3d65c166 ]

There can be a race between the waiters for a tx work request buffer
and the link down processing that finally clears the link. Although
all waiters are woken up before the link is cleared there might be
waiters which did not yet get back control and are still waiting.
This results in an access to a cleared wait queue head.

Fix this by introducing atomic reference counting around the wait calls,
and wait with the link clear processing until all waiters have finished.
Move the work request layer related calls into smc_wr.c and set the
link state to INACTIVE before calling smcr_link_clear() in
smc_llc_srv_add_link().

Fixes: 15e1b99aad ("net/smc: no WR buffer wait for terminating link group")
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Guvenc Gulce <guvenc@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-08-18 08:59:10 +02:00
..
af_smc.c smc: disallow TCP_ULP in smc_setsockopt() 2021-05-19 10:13:08 +02:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
smc.h net/smc: introduce CLC first contact extension 2020-09-28 15:19:03 -07:00
smc_cdc.c net/smc: use separate work queues for different worker types 2020-09-10 15:24:27 -07:00
smc_cdc.h net/smc: pre-fetch send buffer outside of send_lock 2020-05-30 18:12:25 -07:00
smc_clc.c net/smc: CLC decline - V2 enhancements 2020-09-28 15:19:03 -07:00
smc_clc.h net/smc: Replace zero-length array with flexible-array member 2020-10-30 16:57:42 -05:00
smc_close.c net/smc: check variable before dereferencing in smc_close.c 2020-09-16 17:30:16 -07:00
smc_close.h net/smc: remove close abort worker 2019-10-22 11:23:44 -07:00
smc_core.c net/smc: fix matching of existing link groups 2020-11-19 10:59:19 -08:00
smc_core.h net/smc: fix wait on already cleared link 2021-08-18 08:59:10 +02:00
smc_diag.c net/smc: use the retry mechanism for netlink messages 2020-09-10 15:24:27 -07:00
smc_ib.c net/smc: fix direct access to ib_gid_addr->ndev in smc_ib_determine_gid() 2020-11-19 10:59:19 -08:00
smc_ib.h net/smc: protect smc ib device initialization 2020-07-19 15:30:22 -07:00
smc_ism.c net/smc: remove device from smcd_dev_list after failed device_add() 2021-06-03 09:00:48 +02:00
smc_ism.h net/smc: introduce CHID callback for ISM devices 2020-09-28 15:19:03 -07:00
smc_llc.c net/smc: fix wait on already cleared link 2021-08-18 08:59:10 +02:00
smc_llc.h net/smc: move add link processing for new device into llc layer 2020-07-19 15:30:22 -07:00
smc_netns.h net/smc: introduce list of pnetids for Ethernet devices 2020-09-28 15:19:03 -07:00
smc_pnet.c net/smc: determine proposed ISM devices 2020-09-28 15:19:03 -07:00
smc_pnet.h net/smc: determine proposed ISM devices 2020-09-28 15:19:03 -07:00
smc_rx.c fs: make the pipe_buf_operations ->confirm operation optional 2020-05-20 12:11:26 -04:00
smc_rx.h smc: add support for splice() 2018-05-04 11:45:06 -04:00
smc_tx.c net/smc: fix wait on already cleared link 2021-08-18 08:59:10 +02:00
smc_tx.h net/smc: eliminate cursor read and write calls 2018-07-23 10:57:14 -07:00
smc_wr.c net/smc: fix wait on already cleared link 2021-08-18 08:59:10 +02:00
smc_wr.h net/smc: wait for departure of an IB message 2020-05-04 10:54:39 -07:00