mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kshitiz Varshney <kshitiz.varshney@nxp.com>
To: Horia Geanta <horia.geanta@nxp.com>,
	Pankaj Gupta <pankaj.gupta@nxp.com>,
	Varun Sethi <V.Sethi@nxp.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	Iuliana Prodan <iuliana.prodan@nxp.com>,
	Gaurav Jain <gaurav.jain@nxp.com>,
	Rahul Kumar Yadav <rahulkumar.yadav@nxp.com>,
	Vabhav Sharma <vabhav.sharma@nxp.com>,
	Sahil Malhotra <sahil.malhotra@nxp.com>,
	Matt Mackall <mpm@selenic.com>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>,
	Martin Kaiser <martin@kaiser.cx>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org,
	Kshitiz Varshney <kshitiz.varshney@nxp.com>
Subject: [PATCH v1] Moving IRQ handler registering after imx_rngc_irq_mask_clear()
Date: Mon, 22 Aug 2022 13:19:03 +0200	[thread overview]
Message-ID: <20220822111903.328957-1-kshitiz.varshney@nxp.com> (raw)

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


             reply	other threads:[~2022-08-22 11:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22 11:19 Kshitiz Varshney [this message]
2022-09-02 11:00 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220822111903.328957-1-kshitiz.varshney@nxp.com \
    --to=kshitiz.varshney@nxp.com \
    --cc=V.Sethi@nxp.com \
    --cc=davem@davemloft.net \
    --cc=festevam@gmail.com \
    --cc=gaurav.jain@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=iuliana.prodan@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@kaiser.cx \
    --cc=mpm@selenic.com \
    --cc=pankaj.gupta@nxp.com \
    --cc=prasannatsmkumar@gmail.com \
    --cc=rahulkumar.yadav@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=s.trumtrar@pengutronix.de \
    --cc=sahil.malhotra@nxp.com \
    --cc=shawnguo@kernel.org \
    --cc=vabhav.sharma@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®