From: D. Wythe Date: Wed, 2 Mar 2022 13:25:11 +0000 (+0800) Subject: net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error generated by client X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=acff2f561ff46081dc5ec3d9f753382867504f05;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 0de788fa43e9..a5fe8c10bb23 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -239,8 +239,8 @@ void smc_conn_free(struct smc_connection *conn) if (!lgr) return; smc_cdc_tx_dismiss_slots(conn); - smc_lgr_unregister_conn(conn); smc_buf_unuse(conn); + smc_lgr_unregister_conn(conn); } static void smc_link_clear(struct smc_link *lnk)