summaryrefslogtreecommitdiff
path: root/net/tipc
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2016-08-24 13:32:19 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-10 10:26:28 +0200
commit720ef97e3c7fa7c7fa2333fb1d1503bc2920a3ef (patch)
tree236451ae8930db5ae6d704ba07f8441886f43325 /net/tipc
parent302257df964f8f08dc6f3a3e4f819d55fff7a571 (diff)
tipc: fix the error handling in tipc_udp_enable()
commit a5de125dd46c851fc962806135953c1bd0a0f0df upstream. Fix to return a negative error code in enable_mcast() error handling case, and release udp socket when necessary. Fixes: d0f91938bede ("tipc: add ip/udp media type") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/udp_media.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 78d6b78de29d..cb39f1c4251e 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -405,10 +405,13 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
tuncfg.encap_destroy = NULL;
setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
- if (enable_mcast(ub, remote))
+ err = enable_mcast(ub, remote);
+ if (err)
goto err;
return 0;
err:
+ if (ub->ubsock)
+ udp_tunnel_sock_release(ub->ubsock);
kfree(ub);
return err;
}