Commit a58c815b authored by Jason A. Donenfeld's avatar Jason A. Donenfeld Committed by Zheng Zengkai
Browse files

init: call time_init() before rand_initialize()

stable inclusion
from stable-v5.10.119
commit 7d9eab78bed97625619c30b4dbc27a4702c589ad
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6BB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7d9eab78bed97625619c30b4dbc27a4702c589ad



--------------------------------

commit fe222a6c 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: default avatarStafford Horne <shorne@gmail.com>
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>

 Conflicts:
	init/main.c
[zzk: use the v5.19-rc1 solution fe222a6c ("init: call time_init() before rand_initialize()")]

Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent 881e20e4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment