Commit 4d08b7b5 authored by Tony Lu's avatar Tony Lu Committed by David S. Miller

net/smc: Fix cleanup when register ULP fails

This patch calls smc_ib_unregister_client() when tcp_register_ulp()
fails, and make sure to clean it up.

Fixes: d7cd421d ("net/smc: Introduce TCP ULP support")
Signed-off-by: default avatarTony Lu <tonylu@linux.alibaba.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9995b408
...@@ -3087,12 +3087,14 @@ static int __init smc_init(void) ...@@ -3087,12 +3087,14 @@ static int __init smc_init(void)
rc = tcp_register_ulp(&smc_ulp_ops); rc = tcp_register_ulp(&smc_ulp_ops);
if (rc) { if (rc) {
pr_err("%s: tcp_ulp_register fails with %d\n", __func__, 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); static_branch_enable(&tcp_have_smc);
return 0; return 0;
out_ib:
smc_ib_unregister_client();
out_sock: out_sock:
sock_unregister(PF_SMC); sock_unregister(PF_SMC);
out_proto6: out_proto6:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment