Skip to contentSkip to conversation

tipc: fix possible memory leak in tipc_udp_enable()

PATCH Applied Wei Yongjun 2 participants 2 messages Sep 10, 2016 – Sep 13, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tipc: fix possible memory leak in tipc_udp_enable()

From: Wei Yongjun <[email protected]>

'ub' is malloced in tipc_udp_enable() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak.

Fixes ba5aa84a2d22 ("tipc: split UDP nl address parsing")
---
 net/tipc/udp_media.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/tipc/udp_media.c +2 -1
index dd27468..d80cd3f 100644
@@ -665,7 +665,8 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
 
 	if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {
 		pr_err("Invalid UDP bearer configuration");
-		return -EINVAL;
+		err = -EINVAL;
+		goto err;
 	}
 
 	err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_LOCAL], &local,
maintainer Applied
#1 lore raw

From: Wei Yongjun <[email protected]>
Date: Sat, 10 Sep 2016 00:56:55 +0000

Quoted 8 lines

From: Wei Yongjun <[email protected]>

'ub' is malloced in tipc_udp_enable() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak.

Fixes ba5aa84a2d22 ("tipc: split UDP nl address parsing")

Applied, thanks.