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 init_completion before request_irq
Date: Fri, 29 Jul 2022 12:02:11 +0200	[thread overview]
Message-ID: <20220729100211.2204126-1-kshitiz.varshney@nxp.com> (raw)

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


             reply	other threads:[~2022-07-29 10:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 10:02 Kshitiz Varshney [this message]
2022-07-29 10:21 ` Ahmad Fatoum
2022-07-30 15:00   ` Martin Kaiser

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=20220729100211.2204126-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®