random: check for crng_init == 0 in add_device_randomness()
authorJason A. Donenfeld <Jason@zx2c4.com>
Sat, 12 Feb 2022 22:57:38 +0000 (23:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 May 2022 07:29:09 +0000 (09:29 +0200)
commit98d6def672fd10d546129cb07dc7268c5f634079
tree98e9be29eecaa0c027aedddcfd30e842a6729819
parent9df4a56fad32c31049bebc9800b4ea50e1288093
random: check for crng_init == 0 in add_device_randomness()

commit 1daf2f387652bf3a7044aea042f5023b3f6b189b upstream.

This has no real functional change, as crng_pre_init_inject() (and
before that, crng_slow_init()) always checks for == 0, not >= 2. So
correct the outer unlocked change to reflect that. Before this used
crng_ready(), which was not correct.

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