diff options
author | Wen Gu <guwen@linux.alibaba.com> | 2022-01-13 11:36:41 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-01-13 16:14:53 +0300 |
commit | ea89c6c0983c39702a4a52ccaa4702e0cb71179b (patch) | |
tree | 9e8c99b82d0eeaee64d464df07eacc135608cfcf /net/smc/af_smc.c | |
parent | 91341fa0003befd097e190ec2a4bf63ad957c49a (diff) | |
download | linux-ea89c6c0983c39702a4a52ccaa4702e0cb71179b.tar.xz |
net/smc: Introduce a new conn->lgr validity check helper
It is no longer suitable to identify whether a smc connection
is registered in a link group through checking if conn->lgr
is NULL, because conn->lgr won't be reset even the connection
is unregistered from a link group.
So this patch introduces a new helper smc_conn_lgr_valid() and
replaces all the check of conn->lgr in original implementation
with the new helper to judge if conn->lgr is valid to use.
Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/af_smc.c')
-rw-r--r-- | net/smc/af_smc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index aa3bcaaeabf7..961854e56736 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -634,9 +634,13 @@ static void smc_conn_abort(struct smc_sock *smc, int local_first) { struct smc_connection *conn = &smc->conn; struct smc_link_group *lgr = conn->lgr; + bool lgr_valid = false; + + if (smc_conn_lgr_valid(conn)) + lgr_valid = true; smc_conn_free(conn); - if (local_first) + if (local_first && lgr_valid) smc_lgr_cleanup_early(lgr); } |