mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] Moving init_completion before request_irq
@ 2022-07-29 10:02 Kshitiz Varshney
  2022-07-29 10:21 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Kshitiz Varshney @ 2022-07-29 10:02 UTC (permalink / raw)
  To: Horia Geanta, Pankaj Gupta, Varun Sethi, Herbert Xu,
	David S . Miller, Iuliana Prodan, Gaurav Jain, Rahul Kumar Yadav,
	Vabhav Sharma, Sahil Malhotra, Matt Mackall, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Steffen Trumtrar, PrasannaKumar Muralidharan, Martin Kaiser
  Cc: linux-crypto, linux-kernel, linux-imx, linux-arm-kernel,
	Kshitiz Varshney

Issue:
While servicing interrupt, trying to access variable rng_op_done,
which is not yet initalized hence causing kernel to crash
while booting.

Fix:
Moving initialization of rng_op_done before request_irq.

Fixes: 1d5449445bd0 (hwrng: mx-rngc - add a driver for Freescale RNGC)
Signed-off-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
---
 drivers/char/hw_random/imx-rngc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index b05d676ca814..53e571c4f283 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -270,6 +270,8 @@ static int imx_rngc_probe(struct platform_device *pdev)
 		goto err;
 	}
 
+	init_completion(&rngc->rng_op_done);
+
 	ret = devm_request_irq(&pdev->dev,
 			irq, imx_rngc_irq, 0, pdev->name, (void *)rngc);
 	if (ret) {
@@ -277,7 +279,6 @@ static int imx_rngc_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	init_completion(&rngc->rng_op_done);
 
 	rngc->rng.name = pdev->name;
 	rngc->rng.init = imx_rngc_init;
-- 
2.25.1


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

end of thread, other threads:[~2022-07-30 15:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29 10:02 [PATCH v1] Moving init_completion before request_irq Kshitiz Varshney
2022-07-29 10:21 ` Ahmad Fatoum
2022-07-30 15:00   ` Martin Kaiser

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

all inboxes | Powered by JetHome®