[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220729100211.2204126-1-kshitiz.varshney@nxp.com>
Date: Fri, 29 Jul 2022 12:02:11 +0200
From: Kshitiz Varshney <kshitiz.varshney@....com>
To: Horia Geanta <horia.geanta@....com>,
Pankaj Gupta <pankaj.gupta@....com>,
Varun Sethi <V.Sethi@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S . Miller" <davem@...emloft.net>,
Iuliana Prodan <iuliana.prodan@....com>,
Gaurav Jain <gaurav.jain@....com>,
Rahul Kumar Yadav <rahulkumar.yadav@....com>,
Vabhav Sharma <vabhav.sharma@....com>,
Sahil Malhotra <sahil.malhotra@....com>,
Matt Mackall <mpm@...enic.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Steffen Trumtrar <s.trumtrar@...gutronix.de>,
PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>,
Martin Kaiser <martin@...ser.cx>
Cc: linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-imx@....com, linux-arm-kernel@...ts.infradead.org,
Kshitiz Varshney <kshitiz.varshney@....com>
Subject: [PATCH v1] Moving init_completion before request_irq
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@....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
Powered by blists - more mailing lists