From: Tom Lendacky <thomas.lendacky@amd.com>
To: Keith Packard <keithp@keithp.com>, linux-kernel@vger.kernel.org
Cc: Matt Mackall <mpm@selenic.com>, Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH] hwrng: Explicitly drop current_rng when unregistering rng device
Date: Wed, 31 Jan 2018 08:36:42 -0600 [thread overview]
Message-ID: <3f489790-dbfd-e726-e957-7bc7af0745bb@amd.com> (raw)
In-Reply-To: <20180130232627.3014-1-keithp@keithp.com>
On 1/30/2018 5:26 PM, Keith Packard wrote:
> When the currently in-use hw rng is being removed from the system,
> explicitly drop it before using enable_best_rng as enable_best_rng
> will not do anything if the list of avaialble RNGs is empty.
>
> Without this, the last RNG removed from the system will never get
> cleaned up and hwrng_unregister will hang.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
> drivers/char/hw_random/core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
> index 657b8770b6b9..8df3f9f147e2 100644
> --- a/drivers/char/hw_random/core.c
> +++ b/drivers/char/hw_random/core.c
> @@ -515,8 +515,10 @@ void hwrng_unregister(struct hwrng *rng)
> mutex_lock(&rng_mutex);
>
> list_del(&rng->list);
> - if (current_rng == rng)
> + if (current_rng == rng) {
> + drop_current_rng();
> enable_best_rng();
> + }
A similar fix was already in the cryptodev tree and I thought was part of
a recent pull request.
Thanks,
Tom
>
> if (list_empty(&rng_list)) {
> mutex_unlock(&rng_mutex);
>
next prev parent reply other threads:[~2018-01-31 14:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-30 23:26 [PATCH] hwrng: Explicitly drop current_rng when unregistering rng device Keith Packard
2018-01-31 14:36 ` Tom Lendacky [this message]
2018-02-05 0:08 ` Keith Packard
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=3f489790-dbfd-e726-e957-7bc7af0745bb@amd.com \
--to=thomas.lendacky@amd.com \
--cc=herbert@gondor.apana.org.au \
--cc=keithp@keithp.com \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.