diff options
author | Tommi Rantala <tommi.t.rantala@nokia.com> | 2017-12-22 09:35:16 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-27 10:54:59 -0500 |
commit | 19142551b2be4a9e13838099fde1351386e5e007 (patch) | |
tree | 14dfb9960bbccb771cec3be19a1b0408414c8b89 /net | |
parent | 14e138a86f6347c6199f610576d2e11c03bec5f0 (diff) | |
download | linux-19142551b2be4a9e13838099fde1351386e5e007.tar.bz2 |
tipc: error path leak fixes in tipc_enable_bearer()
Fix memory leak in tipc_enable_bearer() if enable_media() fails, and
cleanup with bearer_disable() if tipc_mon_create() fails.
Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/tipc/bearer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 47ec121574ce..c8001471da6c 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -324,6 +324,7 @@ restart: if (res) { pr_warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res); + kfree(b); return -EINVAL; } @@ -347,8 +348,10 @@ restart: if (skb) tipc_bearer_xmit_skb(net, bearer_id, skb, &b->bcast_addr); - if (tipc_mon_create(net, bearer_id)) + if (tipc_mon_create(net, bearer_id)) { + bearer_disable(net, b); return -ENOMEM; + } pr_info("Enabled bearer <%s>, discovery domain %s, priority %u\n", name, |