tipc: fix a double free in tipc_enable_bearer()
authorCong Wang <xiyou.wangcong@gmail.com>
Mon, 24 Dec 2018 05:45:56 +0000 (21:45 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Dec 2018 00:16:17 +0000 (16:16 -0800)
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: syzbot+b981acf1fb240c0c128b@syzkaller.appspotmail.com
Cc: Ying Xue <ying.xue@windriver.com>
Cc: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/bearer.c

index fb2c0d8f359f604938e198c040c8cd032206b028..d27f30a9a01d8d34b3f46d6fc12f2d192d6f3494 100644 (file)
@@ -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;
        }