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:27:15 +0000 (09:27 +0200)
commit6521446a5f21c299100693046b1cb5605985902d
treef001a2de49ef4c9c6888e3075d4a5ace3ad9fb37
parentc7a9336169b358b1e1aae60df219ad39a8e0ec35
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