From: Corentin Labbe Date: Fri, 24 Nov 2017 08:22:07 +0000 (+0000) Subject: crypto: arm64/aes - do not call crypto_unregister_skcipher twice on error X-Git-Tag: v4.19~1578^2~139 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45223b78118cbab12744a7e193b6c7c208c15c27;p=platform%2Fkernel%2Flinux-rpi3.git crypto: arm64/aes - do not call crypto_unregister_skcipher twice on error When a cipher fails to register in aes_init(), the error path goes thought aes_exit() then crypto_unregister_skciphers(). Since aes_exit calls also crypto_unregister_skcipher, this triggers a refcount_t: underflow; use-after-free. Signed-off-by: Corentin Labbe Signed-off-by: Herbert Xu --- diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c index 998ba51..2fa850e 100644 --- a/arch/arm64/crypto/aes-glue.c +++ b/arch/arm64/crypto/aes-glue.c @@ -665,6 +665,7 @@ static int __init aes_init(void) unregister_simds: aes_exit(); + return err; unregister_ciphers: crypto_unregister_skciphers(aes_algs, ARRAY_SIZE(aes_algs)); return err;