Skip to content

Commit 23fa00f

Browse files
herbertxgregkh
authored andcommitted
crypto: pcrypt - Fix user-after-free on module unload
commit 07bfd9b 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: 5068c7a ("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>
1 parent 4017c58 commit 23fa00f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎crypto/pcrypt.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,12 @@ static int __init pcrypt_init(void)
362362

363363
static void __exit pcrypt_exit(void)
364364
{
365+
crypto_unregister_template(&pcrypt_tmpl);
366+
365367
pcrypt_fini_padata(pencrypt);
366368
pcrypt_fini_padata(pdecrypt);
367369

368370
kset_unregister(pcrypt_kset);
369-
crypto_unregister_template(&pcrypt_tmpl);
370371
}
371372

372373
subsys_initcall(pcrypt_init);

0 commit comments

Comments
 (0)