Re: [PATCH] random: fix locking for crng_init in crng_reseed()

From: Eric Biggers
Date: Sun Feb 20 2022 - 23:05:46 EST


On Wed, Feb 09, 2022 at 07:57:06PM +0100, Dominik Brodowski wrote:
> crng_init is protected by primary_crng->lock. Therefore, we need
> to hold this lock when increasing crng_init to 2. As we shouldn't
> hold this lock for too long, only hold it for those parts which
> require protection.
>
> Signed-off-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/char/random.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>

Reviewed-by: Eric Biggers <ebiggers@xxxxxxxxxx>

Though to bikeshed on the variable name, I think that 'became_ready' would be
more self-explanatory than 'complete_init' (this patch) and 'finalize_init'
(the version committed).

- Eric