[PATCH net-next] tipc: fix error handling in tipc_udp_enable()

Subsystems: networking [general], the rest, tipc network layer

STALE3125d

3 messages, 3 authors, 2018-03-27 · open the first message on its own page

[PATCH net-next] tipc: fix error handling in tipc_udp_enable()

From: Wei Yongjun <hidden>
Date: 2018-03-26 14:27:43

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 <redacted>
---
 net/tipc/udp_media.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 2c13b18..e7d91f5 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;

RE: [PATCH net-next] tipc: fix error handling in tipc_udp_enable()

From: Jon Maloy <hidden>
Date: 2018-03-26 14:45:02

Acked-by: Jon Maloy <redacted>
Thank you, Wei.
quoted hunk
-----Original Message-----
From: Wei Yongjun [mailto:weiyongjun1@huawei.com]
Sent: Monday, March 26, 2018 10:33
To: Jon Maloy <redacted>; Ying Xue
[off-list ref]
Cc: Wei Yongjun <redacted>; netdev@vger.kernel.org;
tipc-discussion@lists.sourceforge.net; kernel-janitors@vger.kernel.org
Subject: [PATCH net-next] 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 <redacted>
---
 net/tipc/udp_media.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c index
2c13b18..e7d91f5 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;

Re: [PATCH net-next] tipc: fix error handling in tipc_udp_enable()

From: David Miller <davem@davemloft.net>
Date: 2018-03-27 14:50:48

From: Wei Yongjun <redacted>
Date: Mon, 26 Mar 2018 14:32:44 +0000
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 <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help