summaryrefslogtreecommitdiffstats
path: root/net/smc
diff options
context:
space:
mode:
authorD. Wythe <alibuda@linux.alibaba.com>2022-03-02 21:25:11 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-03-08 19:04:08 +0100
commite84b216e55ac570f7a137e3bc78c80fc44f6aa2e (patch)
treeb5f633430d1f18b174034e2a96ece659b6917b6f /net/smc
parent155e6abb1d71078ef3a0bf38c4cb3f69b200e9fa (diff)
downloadlinux-stable-e84b216e55ac570f7a137e3bc78c80fc44f6aa2e.tar.gz
linux-stable-e84b216e55ac570f7a137e3bc78c80fc44f6aa2e.tar.bz2
linux-stable-e84b216e55ac570f7a137e3bc78c80fc44f6aa2e.zip
net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error generated by client
commit 0537f0a2151375dcf90c1bbfda6a0aaf57164e89 upstream. The main reason for this unexpected SMC_CLC_DECL_ERR_REGRMB in client dues to following execution sequence: Server Conn A: Server Conn B: Client Conn B: smc_lgr_unregister_conn smc_lgr_register_conn smc_clc_send_accept -> smc_rtoken_add smcr_buf_unuse -> Client Conn A: smc_rtoken_delete smc_lgr_unregister_conn() makes current link available to assigned to new incoming connection, while smcr_buf_unuse() has not executed yet, which means that smc_rtoken_add may fail because of insufficient rtoken_entry, reversing their execution order will avoid this problem. Fixes: 3e034725c0d8 ("net/smc: common functions for RMBs and send buffers") Signed-off-by: D. Wythe <alibuda@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/smc')
-rw-r--r--net/smc/smc_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index e7a6c8dcf6b8..59baa53201c5 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -321,8 +321,8 @@ void smc_conn_free(struct smc_connection *conn)
} else {
smc_cdc_tx_dismiss_slots(conn);
}
- smc_lgr_unregister_conn(conn); /* unsets conn->lgr */
smc_buf_unuse(conn, lgr); /* allow buffer reuse */
+ smc_lgr_unregister_conn(conn); /* unsets conn->lgr */
if (!lgr->conns_num)
smc_lgr_schedule_free_work(lgr);