linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] Moving IRQ handler registering after imx_rngc_irq_mask_clear()
@ 2022-08-22 11:19 Kshitiz Varshney
  2022-09-02 11:00 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Kshitiz Varshney @ 2022-08-22 11:19 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, if the IRQ happens to be because of a SEED_DONE
due to a previous boot stage, you end up completing the completion
prematurely, hence causing kernel to crash while booting.

Fix:
Moving IRQ handler registering after imx_rngc_irq_mask_clear()

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 | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index 53e571c4f283..0b71ed850809 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -272,14 +272,6 @@ static int imx_rngc_probe(struct platform_device *pdev)
 
 	init_completion(&rngc->rng_op_done);
 
-	ret = devm_request_irq(&pdev->dev,
-			irq, imx_rngc_irq, 0, pdev->name, (void *)rngc);
-	if (ret) {
-		dev_err(rngc->dev, "Can't get interrupt working.\n");
-		goto err;
-	}
-
-
 	rngc->rng.name = pdev->name;
 	rngc->rng.init = imx_rngc_init;
 	rngc->rng.read = imx_rngc_read;
@@ -291,6 +283,14 @@ static int imx_rngc_probe(struct platform_device *pdev)
 
 	imx_rngc_irq_mask_clear(rngc);
 
+
+	ret = devm_request_irq(&pdev->dev,
+			irq, imx_rngc_irq, 0, pdev->name, (void *)rngc);
+
+	if (ret) {
+		dev_err(rngc->dev, "Can't get interrupt working.\n");
+		goto err;
+	}
 	if (self_test) {
 		ret = imx_rngc_self_test(rngc);
 		if (ret) {
-- 
2.25.1


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

* Re: [PATCH v1] Moving IRQ handler registering after imx_rngc_irq_mask_clear()
  2022-08-22 11:19 [PATCH v1] Moving IRQ handler registering after imx_rngc_irq_mask_clear() Kshitiz Varshney
@ 2022-09-02 11:00 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2022-09-02 11:00 UTC (permalink / raw)
  To: Kshitiz Varshney
  Cc: Horia Geanta, Pankaj Gupta, Varun Sethi, 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, linux-crypto,
	linux-kernel, linux-imx, linux-arm-kernel

On Mon, Aug 22, 2022 at 01:19:03PM +0200, Kshitiz Varshney wrote:
> Issue:
> While servicing interrupt, if the IRQ happens to be because of a SEED_DONE
> due to a previous boot stage, you end up completing the completion
> prematurely, hence causing kernel to crash while booting.
> 
> Fix:
> Moving IRQ handler registering after imx_rngc_irq_mask_clear()
> 
> 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 | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 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:[~2022-09-02 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-22 11:19 [PATCH v1] Moving IRQ handler registering after imx_rngc_irq_mask_clear() Kshitiz Varshney
2022-09-02 11:00 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).