crypto: arm64/aes - do not call crypto_unregister_skcipher twice on error
authorCorentin Labbe <clabbe@baylibre.com>
Fri, 24 Nov 2017 08:22:07 +0000 (08:22 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 29 Nov 2017 06:33:34 +0000 (17:33 +1100)
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 <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm64/crypto/aes-glue.c

index 998ba51..2fa850e 100644 (file)
@@ -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;