ARM64: crypto: do not call crypto_unregister_skcipher twice on error
Subsystems (2)
PATCH v2 1/1 ARM64: crypto: 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 arefcount_t: underflow; use-after-free.
Signed-off-by Corentin Labbe <[email protected]>
---
Changes since v1:
- Instead of duplicate code from aes_exit() minus crypto_unregister_skciphers, simply use it and return after as suggested by Ard Biesheuvel
arch/arm64/crypto/aes-glue.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/crypto/aes-glue.c +1 -0
@@ -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;
Signature · 1 line
2.13.6
Herbert Xu
maintainerQuoted 6 lines · Corentin Labbe
When a cipher fails to register in
aes_init(), the error path goes thoughtaes_exit()thencrypto_unregister_skciphers().
Sinceaes_exitcalls alsocrypto_unregister_skcipher, this triggers arefcount_t: underflow; use-after-free.Signed-off-by Corentin Labbe <[email protected]>
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt