init: call time_init() before rand_initialize()
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 5 May 2022 00:20:22 +0000 (02:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 May 2022 07:29:12 +0000 (09:29 +0200)
commit807ed9c29586e6b958e102c4cee793d6e282620e
treece86cb5b6be93ae615cca728c62b55d190295547
parent2814a9e632db40f6591b12f1e8b6b610ee1bd854
init: call time_init() before rand_initialize()

commit fe222a6ca2d53c38433cba5d3be62a39099e708e upstream.

Currently time_init() is called after rand_initialize(), but
rand_initialize() makes use of the timer on various platforms, and
sometimes this timer needs to be initialized by time_init() first. In
order for random_get_entropy() to not return zero during early boot when
it's potentially used as an entropy source, reverse the order of these
two calls. The block doing random initialization was right before
time_init() before, so changing the order shouldn't have any complicated
effects.

Cc: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
init/main.c