Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH] crypto: keembay - Initialize completion before requesting IRQ
@ 2026-07-14  3:30 Linmao Li
  2026-07-27  0:32 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Linmao Li @ 2026-07-14  3:30 UTC (permalink / raw)
  To: herbert, davem; +Cc: linux-crypto, linux-kernel, Linmao Li

kmb_ocs_aes_probe() requests the device IRQ before initializing
irq_completion. Once the handler is registered it can run immediately,
and ocs_aes_irq_handler() unconditionally calls complete(). An
interrupt in this window would therefore use an uninitialized
completion.

Initialize the completion before requesting the IRQ, as the sibling
OCS HCU and ECC drivers already do.

Fixes: 885743324513 ("crypto: keembay - Add support for Keem Bay OCS AES/SM4")
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
---
 drivers/crypto/intel/keembay/keembay-ocs-aes-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c b/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c
index 8a8f6c81e010..4496f1e64adc 100644
--- a/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c
+++ b/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c
@@ -1602,6 +1602,8 @@ static int kmb_ocs_aes_probe(struct platform_device *pdev)
 	if (IS_ERR(aes_dev->base_reg))
 		return PTR_ERR(aes_dev->base_reg);
 
+	init_completion(&aes_dev->irq_completion);
+
 	/* Get and request IRQ */
 	aes_dev->irq = platform_get_irq(pdev, 0);
 	if (aes_dev->irq < 0)
@@ -1619,8 +1621,6 @@ static int kmb_ocs_aes_probe(struct platform_device *pdev)
 	list_add_tail(&aes_dev->list, &ocs_aes.dev_list);
 	spin_unlock(&ocs_aes.lock);
 
-	init_completion(&aes_dev->irq_completion);
-
 	/* Initialize crypto engine */
 	aes_dev->engine = crypto_engine_alloc_init(dev, true);
 	if (!aes_dev->engine) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: keembay - Initialize completion before requesting IRQ
  2026-07-14  3:30 [PATCH] crypto: keembay - Initialize completion before requesting IRQ Linmao Li
@ 2026-07-27  0:32 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-07-27  0:32 UTC (permalink / raw)
  To: Linmao Li; +Cc: davem, linux-crypto, linux-kernel

On Tue, Jul 14, 2026 at 11:30:15AM +0800, Linmao Li wrote:
> kmb_ocs_aes_probe() requests the device IRQ before initializing
> irq_completion. Once the handler is registered it can run immediately,
> and ocs_aes_irq_handler() unconditionally calls complete(). An
> interrupt in this window would therefore use an uninitialized
> completion.
> 
> Initialize the completion before requesting the IRQ, as the sibling
> OCS HCU and ECC drivers already do.
> 
> Fixes: 885743324513 ("crypto: keembay - Add support for Keem Bay OCS AES/SM4")
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> ---
>  drivers/crypto/intel/keembay/keembay-ocs-aes-core.c | 4 ++--
>  1 file changed, 2 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-07-27  0:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14  3:30 [PATCH] crypto: keembay - Initialize completion before requesting IRQ Linmao Li
2026-07-27  0:32 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox