[PATCH v15 33/35] crypto: amlogic: initialize flow completion before requesting IRQ

Jose Nieto jnieto.alaber at gmail.com
Wed Dec 2 02:10:34 PST 2026


meson_allocate_chanlist() installs the per-flow interrupt handler with
devm_request_irq() before init_completion() runs on that flow.  A pending
interrupt reaching meson_irq_handler() in that window calls complete() on
a zero-initialized completion whose wait-list pointers are still NULL,
leading to a NULL pointer dereference.

Initialize the completion before enabling the interrupt.

Signed-off-by: Jose Nieto <jnieto.alaber at gmail.com>
---
 drivers/crypto/amlogic/amlogic-gxl-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c
index a464a8b76211..18c1edad9475 100644
--- a/drivers/crypto/amlogic/amlogic-gxl-core.c
+++ b/drivers/crypto/amlogic/amlogic-gxl-core.c
@@ -125,6 +125,8 @@ static int meson_allocate_chanlist(struct meson_dev *mc)
 			goto error_engine;
 		}
 
+		init_completion(&mc->chanlist[i].complete);
+
 		err = devm_request_irq(mc->dev, mc->chanlist[i].irq,
 				       meson_irq_handler, 0, "aml-crypto", mc);
 		if (err < 0) {
@@ -133,8 +135,6 @@ static int meson_allocate_chanlist(struct meson_dev *mc)
 			goto error_engine;
 		}
 
-		init_completion(&mc->chanlist[i].complete);
-
 		mc->chanlist[i].engine = crypto_engine_alloc_init(mc->dev, true);
 		if (!mc->chanlist[i].engine) {
 			dev_err(mc->dev, "Cannot allocate engine\n");
-- 
2.47.3




More information about the linux-arm-kernel mailing list