* [PATCH v2] ARM64: crypto: do not call crypto_unregister_skcipher twice on error
@ 2017-11-24 8:22 Corentin Labbe
2017-11-29 6:40 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Corentin Labbe @ 2017-11-24 8:22 UTC (permalink / raw)
To: herbert, davem, catalin.marinas, will.deacon, ard.biesheuvel
Cc: linux-crypto, linux-arm-kernel, linux-kernel, Corentin Labbe
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>
---
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(+)
diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c
index 998ba519a026..2fa850e86aa8 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;
--
2.13.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ARM64: crypto: do not call crypto_unregister_skcipher twice on error
2017-11-24 8:22 [PATCH v2] ARM64: crypto: do not call crypto_unregister_skcipher twice on error Corentin Labbe
@ 2017-11-29 6:40 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2017-11-29 6:40 UTC (permalink / raw)
To: Corentin Labbe
Cc: davem, catalin.marinas, will.deacon, ard.biesheuvel,
linux-crypto, linux-arm-kernel, linux-kernel
On Fri, Nov 24, 2017 at 08:22:07AM +0000, Corentin Labbe wrote:
> 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>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-29 6:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-24 8:22 [PATCH v2] ARM64: crypto: do not call crypto_unregister_skcipher twice on error Corentin Labbe
2017-11-29 6:40 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).