[PATCH v15 33/35] crypto: amlogic: initialize flow completion before requesting IRQ
From: Jose Nieto
Date: Wed Dec 02 2026 - 05:12:06 EST
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@xxxxxxxxx>
---
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