Skip to content

Commit

Permalink
net/smc: Fix cleanup when register ULP fails
Browse files Browse the repository at this point in the history
This patch calls smc_ib_unregister_client() when tcp_register_ulp()
fails, and make sure to clean it up.

Fixes: d7cd421 ("net/smc: Introduce TCP ULP support")
Signed-off-by: Tony Lu <tonylu@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tony Lu authored and David S. Miller committed Feb 28, 2022
1 parent 9995b40 commit 4d08b7b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/smc/af_smc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3087,12 +3087,14 @@ static int __init smc_init(void)
rc = tcp_register_ulp(&smc_ulp_ops);
if (rc) {
pr_err("%s: tcp_ulp_register fails with %d\n", __func__, rc);
goto out_sock;
goto out_ib;
}

static_branch_enable(&tcp_have_smc);
return 0;

out_ib:
smc_ib_unregister_client();
out_sock:
sock_unregister(PF_SMC);
out_proto6:
Expand Down

0 comments on commit 4d08b7b

Please sign in to comment.