summaryrefslogtreecommitdiffstats
path: root/net/tipc/udp_media.c
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2018-03-26 14:32:44 +0000
committerDavid S. Miller <davem@davemloft.net>2018-03-27 10:50:02 -0400
commitc76f2481b60a62814f4cb1678e48efa3385895aa (patch)
tree8afac22694ad35d0facca4992e7f10db51484031 /net/tipc/udp_media.c
parent6a91ded32d6c8a6d0aee1928bb741e31577af24f (diff)
downloadlinux-c76f2481b60a62814f4cb1678e48efa3385895aa.tar.bz2
tipc: fix error handling in tipc_udp_enable()
Release alloced resource before return from the error handling case in tipc_udp_enable(), otherwise will cause memory leak. Fixes: 52dfae5c85a4 ("tipc: obtain node identity from interface by default") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/udp_media.c')
-rw-r--r--net/tipc/udp_media.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 2c13b18426d9..e7d91f5d5cae 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -687,7 +687,8 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
}
if (!tipc_own_id(net)) {
pr_warn("Failed to set node id, please configure manually\n");
- return -EINVAL;
+ err = -EINVAL;
+ goto err;
}
b->bcast_addr.media_id = TIPC_MEDIA_TYPE_UDP;