summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2019-11-19 17:41:31 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-01 09:34:52 +0000
commit11528652a62a77fe4ba8361065114d9da1b71a29 (patch)
treeda8e34c5593f6116aaf6594daefa8d74f48d0e7e
parent902c0f9a2851d44a8c6ccf5887b55e86ca220ed6 (diff)
downloadlinux-crypto-11528652a62a77fe4ba8361065114d9da1b71a29.tar.gz
linux-crypto-11528652a62a77fe4ba8361065114d9da1b71a29.zip
crypto: pcrypt - Fix user-after-free on module unload
commit b61ad212689fc7ef61f32112a0ffddfcbc8a6159 upstream. On module unload of pcrypt we must unregister the crypto algorithms first and then tear down the padata structure. As otherwise the crypto algorithms are still alive and can be used while the padata structure is being freed. Fixes: fa0657180cb8 ("crypto: pcrypt - Add pcrypt crypto...") Cc: <stable@vger.kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--crypto/pcrypt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index 543792e0..81bbea7f 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -362,11 +362,12 @@ err:
static void __exit pcrypt_exit(void)
{
+ crypto_unregister_template(&pcrypt_tmpl);
+
pcrypt_fini_padata(pencrypt);
pcrypt_fini_padata(pdecrypt);
kset_unregister(pcrypt_kset);
- crypto_unregister_template(&pcrypt_tmpl);
}
subsys_initcall(pcrypt_init);