linux/net/smc
Ursula Braun 51e3dfa890 net/smc: fix cleanup for linkgroup setup failures
If an SMC connection to a certain peer is setup the first time,
a new linkgroup is created. In case of setup failures, such a
linkgroup is unusable and should disappear. As a first step the
linkgroup is removed from the linkgroup list in smc_lgr_forget().

There are 2 problems:
smc_listen_decline() might be called before linkgroup creation
resulting in a crash due to calling smc_lgr_forget() with
parameter NULL.
If a setup failure occurs after linkgroup creation, the connection
is never unregistered from the linkgroup, preventing linkgroup
freeing.

This patch introduces an enhanced smc_lgr_cleanup_early() function
which
* contains a linkgroup check for early smc_listen_decline()
  invocations
* invokes smc_conn_free() to guarantee unregistering of the
  connection.
* schedules fast linkgroup removal of the unusable linkgroup

And the unused function smcd_conn_free() is removed from smc_core.h.

Fixes: 3b2dec2603 ("net/smc: restructure client and server code in af_smc")
Fixes: 2a0674fffb ("net/smc: improve abnormal termination of link groups")
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-26 20:18:07 -08:00
..
af_smc.c net/smc: fix cleanup for linkgroup setup failures 2020-02-26 20:18:07 -08:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
smc_cdc.c net/smc: fix final cleanup sequence for SMCD devices 2019-11-15 12:28:28 -08:00
smc_cdc.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-02-15 12:38:38 -08:00
smc_clc.c net/smc: no peer ID in CLC decline for SMCD 2020-02-14 07:09:36 -08:00
smc_clc.h net/smc: improve smc_conn_create reason codes 2019-04-12 10:50:56 -07:00
smc_close.c net/smc: remove unused constant 2019-11-16 12:26:49 -08:00
smc_close.h net/smc: remove close abort worker 2019-10-22 11:23:44 -07:00
smc_core.c net/smc: fix cleanup for linkgroup setup failures 2020-02-26 20:18:07 -08:00
smc_core.h net/smc: fix cleanup for linkgroup setup failures 2020-02-26 20:18:07 -08:00
smc_diag.c net/smc: fix leak of kernel memory to user space 2020-02-11 17:04:42 -08:00
smc_ib.c net/smc: introduce bookkeeping of SMCR link groups 2019-11-16 12:26:49 -08:00
smc_ib.h net/smc: introduce bookkeeping of SMCR link groups 2019-11-16 12:26:49 -08:00
smc_ism.c net/smc: introduce bookkeeping of SMCD link groups 2019-11-15 12:28:28 -08:00
smc_ism.h net/smc: add SMC-D shutdown signal 2018-11-21 16:14:56 -08:00
smc_llc.c net/smc: immediate termination for SMCR link groups 2019-11-15 12:28:28 -08:00
smc_llc.h net/smc: add infrastructure to send delete rkey messages 2018-11-23 17:20:32 -08:00
smc_netns.h net/smc: add pnet table namespace support 2019-02-21 10:34:37 -08:00
smc_pnet.c net/smc: allow unprivileged users to read pnet table 2020-01-21 11:39:56 +01:00
smc_pnet.h net/smc: consolidate function parameters 2019-04-12 10:50:56 -07:00
smc_rx.c net/smc: cancel send and receive for terminated socket 2019-10-22 11:23:43 -07:00
smc_rx.h smc: add support for splice() 2018-05-04 11:45:06 -04:00
smc_tx.c net/smc: abnormal termination of SMCD link groups 2019-11-15 12:28:28 -08: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: wait for tx completions before link freeing 2019-11-15 12:28:28 -08:00
smc_wr.h net/smc: no WR buffer wait for terminating link group 2019-11-15 12:28:28 -08:00
smc.h net/smc: cancel send and receive for terminated socket 2019-10-22 11:23:43 -07:00