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>
Sat, 25 Jun 2022 09:46:39 +0000 (11:46 +0200)
commitfed6de0e0bac9d446de80b4734820c4b16c2abe9
tree72d3bb656596c1c2bb83427dc2e13b2f7df567ae
parent70cf7fb6d379ece8af3326257fa55e5ab18a16d9
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