OSDN Git Service

net/tipc: fix missing destroy_workqueue() on error in tipc_crypto_start()
authorYang Yingliang <yangyingliang@huawei.com>
Wed, 31 Mar 2021 08:36:02 +0000 (16:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 Mar 2021 21:52:00 +0000 (14:52 -0700)
Add the missing destroy_workqueue() before return from
tipc_crypto_start() in the error handling case.

Fixes: 1ef6f7c9390f ("tipc: add automatic session key exchange")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/crypto.c

index 6f64ace..76b8428 100644 (file)
@@ -1492,6 +1492,8 @@ int tipc_crypto_start(struct tipc_crypto **crypto, struct net *net,
        /* Allocate statistic structure */
        c->stats = alloc_percpu_gfp(struct tipc_crypto_stats, GFP_ATOMIC);
        if (!c->stats) {
+               if (c->wq)
+                       destroy_workqueue(c->wq);
                kfree_sensitive(c);
                return -ENOMEM;
        }