linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
To: Martin Kaiser <martin@kaiser.cx>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	NXP Linux Team <linux-imx@nxp.com>,
	"open list:HARDWARE RANDOM NUMBER GENERATOR CORE" 
	<linux-crypto@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/6] hwrng: imx-rngc - use devres for registration
Date: Wed, 12 Feb 2020 21:43:55 +0530	[thread overview]
Message-ID: <CANc+2y6Scy1=S7zeQ4gVowRoWmzsq4wiNXbLVeY1Qvu0oo9cUw@mail.gmail.com> (raw)
In-Reply-To: <20200128110102.11522-4-martin@kaiser.cx>

Hi Martin,

On Tue, 28 Jan 2020 at 16:31, Martin Kaiser <martin@kaiser.cx> wrote:
>
> Use devres to register the rngc with the hwrng core. Drop the explicit
> deregistration.
>
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>  drivers/char/hw_random/imx-rngc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
> index 903894518c8d..1381ddd5b891 100644
> --- a/drivers/char/hw_random/imx-rngc.c
> +++ b/drivers/char/hw_random/imx-rngc.c
> @@ -263,7 +263,7 @@ static int imx_rngc_probe(struct platform_device *pdev)
>                 }
>         }
>
> -       ret = hwrng_register(&rngc->rng);
> +       ret = devm_hwrng_register(&pdev->dev, &rngc->rng);
>         if (ret) {
>                 dev_err(&pdev->dev, "FSL RNGC registering failed (%d)\n", ret);
>                 goto err;
> @@ -282,8 +282,6 @@ static int __exit imx_rngc_remove(struct platform_device *pdev)
>  {
>         struct imx_rngc *rngc = platform_get_drvdata(pdev);
>
> -       hwrng_unregister(&rngc->rng);
> -
>         clk_disable_unprepare(rngc->clk);
>
>         return 0;
> --
> 2.20.1
>

After imx_rngc_remove function hwrng_unregister will get called. This
leaves a window where the clock to rng hardware block is disabled but
still user space can access it via /dev/hwrng. This does not look
right, please revisit the patch.

Regards,
PrasannaKumar

  reply	other threads:[~2020-02-12 16:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 11:00 [PATCH 0/6] imx-rngc - several small fixes Martin Kaiser
2020-01-28 11:00 ` [PATCH 1/6] hwrng: imx-rngc - fix an error path Martin Kaiser
2020-02-12 16:22   ` PrasannaKumar Muralidharan
2020-01-28 11:00 ` [PATCH 2/6] hwrng: imx-rngc - use automatic seeding Martin Kaiser
2020-02-12 16:24   ` PrasannaKumar Muralidharan
2020-01-28 11:00 ` [PATCH 3/6] hwrng: imx-rngc - use devres for registration Martin Kaiser
2020-02-12 16:13   ` PrasannaKumar Muralidharan [this message]
2020-02-17  9:35     ` Martin Kaiser
2020-01-28 11:01 ` [PATCH 4/6] hwrng: imx-rngc - (trivial) simplify error prints Martin Kaiser
2020-02-12 16:24   ` PrasannaKumar Muralidharan
2020-01-28 11:01 ` [PATCH 5/6] hwrng: imx-rngc - check the rng type Martin Kaiser
2020-02-12 16:23   ` PrasannaKumar Muralidharan
2020-01-28 11:01 ` [PATCH 6/6] hwrng: imx-rngc - simplify interrupt mask/unmask Martin Kaiser
2020-03-05 20:58 ` [PATCH v2 0/5] imx-rngc - several small fixes Martin Kaiser
2020-03-05 20:58   ` [PATCH v2 1/5] hwrng: imx-rngc - fix an error path Martin Kaiser
2020-03-05 20:58   ` [PATCH v2 2/5] hwrng: imx-rngc - use automatic seeding Martin Kaiser
2020-03-05 20:58   ` [PATCH v2 3/5] hwrng: imx-rngc - (trivial) simplify error prints Martin Kaiser
2020-03-05 20:58   ` [PATCH v2 4/5] hwrng: imx-rngc - check the rng type Martin Kaiser
2020-03-05 20:58   ` [PATCH v2 5/5] hwrng: imx-rngc - simplify interrupt mask/unmask Martin Kaiser
2020-03-12 12:39   ` [PATCH v2 0/5] imx-rngc - several small fixes 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='CANc+2y6Scy1=S7zeQ4gVowRoWmzsq4wiNXbLVeY1Qvu0oo9cUw@mail.gmail.com' \
    --to=prasannatsmkumar@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --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 \
    /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;
as well as URLs for NNTP newsgroup(s).