OSDN Git Service

net/smc: fix wait on already cleared link
authorKarsten Graul <kgraul@linux.ibm.com>
Mon, 9 Aug 2021 09:05:56 +0000 (11:05 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Aug 2021 09:46:59 +0000 (10:46 +0100)
commit8f3d65c166797746455553f4eaf74a5f89f996d4
tree73d7b5903a3c337a9e30102d6ebccb6989a99a2f
parentacc68b8d2a1196c4db806947606f162dbeed2274
net/smc: fix wait on already cleared link

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: 15e1b99aadfb ("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>
net/smc/smc_core.h
net/smc/smc_llc.c
net/smc/smc_tx.c
net/smc/smc_wr.c