linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Kaiser <martin@kaiser.cx>
To: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
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: Mon, 17 Feb 2020 10:35:47 +0100	[thread overview]
Message-ID: <20200217093547.3an3bzqfutcewe2i@viti.kaiser.cx> (raw)
In-Reply-To: <CANc+2y6Scy1=S7zeQ4gVowRoWmzsq4wiNXbLVeY1Qvu0oo9cUw@mail.gmail.com>

Hi PrasannaKumar,

Thus wrote PrasannaKumar Muralidharan (prasannatsmkumar@gmail.com):

> 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.

thanks for spotting this issue. I see that in __device_release_driver,
the driver's remove function is called before the devres cleanup.

> This does not look right, please revisit the patch.

I checked again how other hwrng drivers use devres. Some don't have to
disable a clock and need no remove function at all. Others enable the
clock in the hwrng init routine and disable it in the cleanup routine.

Both of these approaches don't work here. I should disable the clock
eventually and I need it in the probe function to run the selftest
before hwrng init is called.

Therefore, I suggest to drop this patch, at least for the moment.
Herbert, should I resend the series without this patch or is it ok for
you to take the remaining patches as-is?

BTW, 3e75241be808 ("hwrng: drivers - Use device-managed registration
API") makes the same change that I proposed here for a couple of other
hwrng drivers and seems to introduce the same race condition in som
drivers e.g. drivers/char/hw_random/exynos-trng.c. Should we try to fix
this?

Thanks,
Martin

  reply	other threads:[~2020-02-17  9:35 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
2020-02-17  9:35     ` Martin Kaiser [this message]
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=20200217093547.3an3bzqfutcewe2i@viti.kaiser.cx \
    --to=martin@kaiser.cx \
    --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=prasannatsmkumar@gmail.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;
as well as URLs for NNTP newsgroup(s).