Skip to contentSkip to conversation

tipc: fix a double free in tipc_enable_bearer()

PATCH In review Cong Wang 2 participants 2 messages Dec 24, 2018 – Dec 28, 2018

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 tipc: fix a double free in tipc_enable_bearer()

bearer_disable() already calls kfree_rcu() to free struct tipc_bearer, we don't need to call kfree() again.

Fixes cb30a63384bc ("tipc: refactor function tipc_enable_bearer()")
Reported-by [email protected]
Cc Ying Xue <[email protected]>
Cc Jon Maloy <[email protected]>
---
 net/tipc/bearer.c | 1 -
 1 file changed, 1 deletion(-)
net/tipc/bearer.c +0 -1
index fb2c0d8f359f..d27f30a9a01d 100644
@@ -319,7 +319,6 @@ static int tipc_enable_bearer(struct net *net, const char *name,
 	res = tipc_disc_create(net, b, &b->bcast_addr, &skb);
 	if (res) {
 		bearer_disable(net, b);
-		kfree(b);
 		errstr = "failed to create discoverer";
 		goto rejected;
 	}
Signature · 1 line
2.19.2
maintainer
#1 lore raw

From: Cong Wang <[email protected]>
Date: Sun, 23 Dec 2018 21:45:56 -0800

Quoted 8 lines

bearer_disable() already calls kfree_rcu() to free struct tipc_bearer, we don't need to call kfree() again.

Fixes cb30a63384bc ("tipc: refactor function tipc_enable_bearer()")
Reported-by [email protected]
Cc Ying Xue <[email protected]>
Cc Jon Maloy <[email protected]>

Applied and queued up for -stable, thanks Cong.