random: only call crng_finalize_init() for primary_crng
authorDominik Brodowski <linux@dominikbrodowski.net>
Sun, 30 Jan 2022 21:03:20 +0000 (22:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 May 2022 07:29:03 +0000 (09:29 +0200)
commitadd92df1cb37b5661b28fee5e0591895be5c317f
treedc345d9b6727a2963cd8b2265dd11bce4a8bc5c9
parent07e015230415863e1a10e0f8a8970700c7c62a84
random: only call crng_finalize_init() for primary_crng

commit 9d5505f1eebeca778074a0260ed077fd85f8792c upstream.

crng_finalize_init() returns instantly if it is called for another pool
than primary_crng. The test whether crng_finalize_init() is still required
can be moved to the relevant caller in crng_reseed(), and
crng_need_final_init can be reset to false if crng_finalize_init() is
called with workqueues ready. Then, no previous callsite will call
crng_finalize_init() unless it is needed, and we can get rid of the
superfluous function parameter.

Signed-off-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