lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f489790-dbfd-e726-e957-7bc7af0745bb@amd.com>
Date:   Wed, 31 Jan 2018 08:36:42 -0600
From:   Tom Lendacky <thomas.lendacky@....com>
To:     Keith Packard <keithp@...thp.com>, linux-kernel@...r.kernel.org
Cc:     Matt Mackall <mpm@...enic.com>,
        Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [PATCH] hwrng: Explicitly drop current_rng when unregistering rng
 device

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@...thp.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);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ