* [PATCH] crypto: atmel-aes - guard unregister on error in atmel_aes_register_algs
@ 2026-03-11 11:39 Thorsten Blum
2026-03-21 8:48 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-03-11 11:39 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, Cyrille Pitchen
Cc: Thorsten Blum, linux-crypto, linux-arm-kernel, linux-kernel
Ensure the device supports XTS and GCM with 'has_xts' and 'has_gcm'
before unregistering algorithms when XTS or authenc registration fails,
which would trigger a WARN in crypto_unregister_alg().
Currently, with the capabilities defined in atmel_aes_get_cap(), this
bug cannot happen because all devices that support XTS and authenc also
support GCM, but the error handling should still be correct regardless
of hardware capabilities.
Fixes: d52db5188a87 ("crypto: atmel-aes - add support to the XTS mode")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/crypto/atmel-aes.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index bc0c40f10944..64960eeeb17b 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -2270,10 +2270,12 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd)
/* i = ARRAY_SIZE(aes_authenc_algs); */
err_aes_authenc_alg:
crypto_unregister_aeads(aes_authenc_algs, i);
- crypto_unregister_skcipher(&aes_xts_alg);
+ if (dd->caps.has_xts)
+ crypto_unregister_skcipher(&aes_xts_alg);
#endif
err_aes_xts_alg:
- crypto_unregister_aead(&aes_gcm_alg);
+ if (dd->caps.has_gcm)
+ crypto_unregister_aead(&aes_gcm_alg);
err_aes_gcm_alg:
i = ARRAY_SIZE(aes_algs);
err_aes_algs:
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] crypto: atmel-aes - guard unregister on error in atmel_aes_register_algs
2026-03-11 11:39 [PATCH] crypto: atmel-aes - guard unregister on error in atmel_aes_register_algs Thorsten Blum
@ 2026-03-21 8:48 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-03-21 8:48 UTC (permalink / raw)
To: Thorsten Blum
Cc: David S. Miller, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Cyrille Pitchen, linux-crypto, linux-arm-kernel, linux-kernel
On Wed, Mar 11, 2026 at 12:39:28PM +0100, Thorsten Blum wrote:
> Ensure the device supports XTS and GCM with 'has_xts' and 'has_gcm'
> before unregistering algorithms when XTS or authenc registration fails,
> which would trigger a WARN in crypto_unregister_alg().
>
> Currently, with the capabilities defined in atmel_aes_get_cap(), this
> bug cannot happen because all devices that support XTS and authenc also
> support GCM, but the error handling should still be correct regardless
> of hardware capabilities.
>
> Fixes: d52db5188a87 ("crypto: atmel-aes - add support to the XTS mode")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/crypto/atmel-aes.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
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:[~2026-03-21 8:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11 11:39 [PATCH] crypto: atmel-aes - guard unregister on error in atmel_aes_register_algs Thorsten Blum
2026-03-21 8:48 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox