random: do not use batches when !crng_ready()
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 3 May 2022 12:14:32 +0000 (14:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 May 2022 07:29:15 +0000 (09:29 +0200)
commit0d79a47b4ae06bc4994b9f0d96a41cf48f6d765d
tree3882c99d808ad0291dc944bd584bd9aab9042812
parent1ab530cf40dcd83233724faaa0bd88c6ab3ca2a5
random: do not use batches when !crng_ready()

commit cbe89e5a375a51bbb952929b93fa973416fea74e upstream.

It's too hard to keep the batches synchronized, and pointless anyway,
since in !crng_ready(), we're updating the base_crng key really often,
where batching only hurts. So instead, if the crng isn't ready, just
call into get_random_bytes(). At this stage nothing is performance
critical anyhow.

Cc: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/random.c