Commit 195e2312 authored by Wei Yongjun's avatar Wei Yongjun Committed by Kleber Sacilotto de Souza

tipc: fix the error handling in tipc_udp_enable()

BugLink: https://bugs.launchpad.net/bugs/1878232

commit a5de125d upstream.

Fix to return a negative error code in enable_mcast() error handling
case, and release udp socket when necessary.

Fixes: d0f91938 ("tipc: add ip/udp media type")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 4f704752
...@@ -408,10 +408,13 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, ...@@ -408,10 +408,13 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
tuncfg.encap_destroy = NULL; tuncfg.encap_destroy = NULL;
setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg); setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
if (enable_mcast(ub, remote)) err = enable_mcast(ub, remote);
if (err)
goto err; goto err;
return 0; return 0;
err: err:
if (ub->ubsock)
udp_tunnel_sock_release(ub->ubsock);
kfree(ub); kfree(ub);
return err; return err;
} }
......
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