]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 07:50:32 +0000 (09:50 +0200)
[ Upstream commit ac1db7acea67777be1ba86e36e058c479eab6508 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tipc/crypto.c

index 86eb6d679225c1a004f8f76f4bec48af08bba902..2301b66280def1e8a75f8391205a9be1c1f39348 100644 (file)
@@ -1485,6 +1485,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;
        }