Commit f4c9b3bd authored by Jan Varho's avatar Jan Varho Committed by Zheng Zengkai
Browse files

random: do not split fast init input in add_hwgenerator_randomness()

stable inclusion
from stable-v5.10.119
commit bb515a5beff279443f54802d20d609f7294c98a4
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=bb515a5beff279443f54802d20d609f7294c98a4



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

commit 527a9867 upstream.

add_hwgenerator_randomness() tries to only use the required amount of input
for fast init, but credits all the entropy, rather than a fraction of
it. Since it's hard to determine how much entropy is left over out of a
non-unformly random sample, either give it all to fast init or credit
it, but don't attempt to do both. In the process, we can clean up the
injection code to no longer need to return a value.

Signed-off-by: default avatarJan Varho <jan.varho@gmail.com>
[Jason: expanded commit message]
Fixes: 73c7733f ("random: do not throw away excess input to crng_fast_load")
Cc: stable@vger.kernel.org # 5.17+, requires af704c85
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>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent 7a1eb673
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment