From: Herbert Xu <herbert@gondor.apana.org.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
Matt Mackall <mpm@selenic.com>
Subject: Re: [PATCH] hw_random: move add_early_randomness() out of rng_mutex
Date: Sat, 5 Oct 2019 00:26:03 +1000 [thread overview]
Message-ID: <20191004142603.GA29787@gondor.apana.org.au> (raw)
In-Reply-To: <20190912133022.14870-1-lvivier@redhat.com>
On Thu, Sep 12, 2019 at 03:30:22PM +0200, Laurent Vivier wrote:
>
> @@ -496,19 +510,24 @@ int hwrng_register(struct hwrng *rng)
> goto out_unlock;
> }
>
> - if (old_rng && !rng->init) {
> + new_rng = rng;
> + kref_get(&new_rng->ref);
> +out_unlock:
> + mutex_unlock(&rng_mutex);
> +
> + if (new_rng) {
> + if (new_rng != old_rng || !rng->init) {
Is this really supposed to be || instead of &&?
> /*
> * Use a new device's input to add some randomness to
> * the system. If this rng device isn't going to be
> * used right away, its init function hasn't been
> - * called yet; so only use the randomness from devices
> - * that don't need an init callback.
> + * called yet by set_current_rng(); so only use the
> + * randomness from devices that don't need an init callback
> */
> - add_early_randomness(rng);
> + add_early_randomness(new_rng);
> + }
> + put_rng(new_rng);
> }
Cheers,
--
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
next prev parent reply other threads:[~2019-10-04 14:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 13:30 [PATCH] hw_random: move add_early_randomness() out of rng_mutex Laurent Vivier
2019-10-04 14:26 ` Herbert Xu [this message]
2019-10-04 15:32 ` Laurent Vivier
2019-10-10 12:53 ` Herbert Xu
[not found] ` <CGME20191011084523eucas1p1fe003b9be75fc2fa864f0ab2bd896677@eucas1p1.samsung.com>
2019-10-11 8:45 ` Marek Szyprowski
2019-10-11 11:00 ` Laurent Vivier
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=20191004142603.GA29787@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvivier@redhat.com \
--cc=mpm@selenic.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).