From: Yang Yingliang Date: Wed, 31 Mar 2021 08:36:02 +0000 (+0800) Subject: net/tipc: fix missing destroy_workqueue() on error in tipc_crypto_start() X-Git-Tag: v5.11.21~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aff396dadefdba6a07f39571835332d2ba9fa9ca;p=thirdparty%2Fkernel%2Fstable.git net/tipc: fix missing destroy_workqueue() on error in tipc_crypto_start() [ 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 Signed-off-by: Yang Yingliang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c index 97710ce36047c..c89ce47c56cf2 100644 --- a/net/tipc/crypto.c +++ b/net/tipc/crypto.c @@ -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; }