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: d7cd421da9 ("net/smc: Introduce TCP ULP support")
Signed-off-by: Tony Lu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Tony Lu authored and David S. Miller committed 2022-02-28 11:31:49 +00:00
1 parent 9995b408f1
commit 4d08b7b57e
1 file changed
+3 -1
+3 -1
View File
@@ -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: