* [PATCH net-next] tipc: fix error handling in tipc_udp_enable()
@ 2018-03-26 14:32 Wei Yongjun
2018-03-26 14:44 ` Jon Maloy
2018-03-27 14:50 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2018-03-26 14:32 UTC (permalink / raw)
To: Jon Maloy, Ying Xue; +Cc: Wei Yongjun, netdev, tipc-discussion, kernel-janitors
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>
---
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;
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH net-next] tipc: fix error handling in tipc_udp_enable()
2018-03-26 14:32 [PATCH net-next] tipc: fix error handling in tipc_udp_enable() Wei Yongjun
@ 2018-03-26 14:44 ` Jon Maloy
2018-03-27 14:50 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jon Maloy @ 2018-03-26 14:44 UTC (permalink / raw)
To: Wei Yongjun, Ying Xue
Cc: netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
kernel-janitors@vger.kernel.org
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Thank you, Wei.
> -----Original Message-----
> From: Wei Yongjun [mailto:weiyongjun1@huawei.com]
> Sent: Monday, March 26, 2018 10:33
> To: Jon Maloy <jon.maloy@ericsson.com>; Ying Xue
> <ying.xue@windriver.com>
> Cc: Wei Yongjun <weiyongjun1@huawei.com>; 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 <weiyongjun1@huawei.com>
> ---
> 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;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net-next] tipc: fix error handling in tipc_udp_enable()
2018-03-26 14:32 [PATCH net-next] tipc: fix error handling in tipc_udp_enable() Wei Yongjun
2018-03-26 14:44 ` Jon Maloy
@ 2018-03-27 14:50 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-03-27 14:50 UTC (permalink / raw)
To: weiyongjun1; +Cc: jon.maloy, ying.xue, netdev, tipc-discussion, kernel-janitors
From: Wei Yongjun <weiyongjun1@huawei.com>
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 <weiyongjun1@huawei.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-27 14:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-26 14:32 [PATCH net-next] tipc: fix error handling in tipc_udp_enable() Wei Yongjun
2018-03-26 14:44 ` Jon Maloy
2018-03-27 14:50 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox