OpenCloudOS-Kernel/drivers/char/hw_random
Laurent Vivier 78887832e7 hwrng: core - don't wait on add_early_randomness()
add_early_randomness() is called by hwrng_register() when the
hardware is added. If this hardware and its module are present
at boot, and if there is no data available the boot hangs until
data are available and can't be interrupted.

For instance, in the case of virtio-rng, in some cases the host can be
not able to provide enough entropy for all the guests.

We can have two easy ways to reproduce the problem but they rely on
misconfiguration of the hypervisor or the egd daemon:

- if virtio-rng device is configured to connect to the egd daemon of the
host but when the virtio-rng driver asks for data the daemon is not
connected,

- if virtio-rng device is configured to connect to the egd daemon of the
host but the egd daemon doesn't provide data.

The guest kernel will hang at boot until the virtio-rng driver provides
enough data.

To avoid that, call rng_get_data() in non-blocking mode (wait=0)
from add_early_randomness().

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Fixes: d9e7972619 ("hwrng: add randomness to system from rng...")
Cc: <stable@vger.kernel.org>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2019-09-20 23:05:33 +10:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile hwrng: add OP-TEE based rng driver 2019-02-01 15:12:46 +01:00
amd-rng.c hwrng: amd - Revert managed API changes 2017-03-16 17:43:10 +08:00
atmel-rng.c hwrng: drivers - Use device-managed registration API 2019-08-02 14:44:33 +10:00
bcm2835-rng.c hwrng: bcm2835 - fix probe as platform device 2019-02-28 14:17:58 +08:00
cavium-rng-vf.c hwrng: drivers - Use device-managed registration API 2019-08-02 14:44:33 +10:00
cavium-rng.c hwrng: cavium - make two functions static 2018-03-09 22:45:34 +08:00
core.c hwrng: core - don't wait on add_early_randomness() 2019-09-20 23:05:33 +10:00
exynos-trng.c hwrng: drivers - Use device-managed registration API 2019-08-02 14:44:33 +10:00
geode-rng.c hwrng: geode - Revert managed API changes 2017-03-16 17:43:11 +08:00
hisi-rng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
imx-rngc.c hwrng: imx-rngc - use devm_platform_ioremap_resource() to simplify code 2019-07-27 21:08:32 +10:00
intel-rng.c hwrng: printk replacement 2014-10-02 14:35:00 +08:00
iproc-rng200.c hwrng: iproc-rng200 - Add support for 7211 2019-06-20 14:18:32 +08:00
ixp4xx-rng.c IXP4xx: HW pseudo-random generator is available on IXP45x/46x only. 2012-11-22 03:35:39 +00:00
ks-sa-rng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
meson-rng.c hwrng: meson - update with SPDX Licence identifier 2019-05-30 15:28:40 +08:00
mtk-rng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
mxc-rnga.c hwrng: mxc-rnga - use devm_platform_ioremap_resource() to simplify code 2019-07-27 21:08:32 +10:00
n2-asm.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
n2-drv.c hwrng: n2-drv - fix typo 2019-08-08 12:07:49 +10:00
n2rng.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nomadik-rng.c hwrng: drivers - Use device-managed registration API 2019-08-02 14:44:33 +10:00
octeon-rng.c hwrng: octeon - Use devm_hwrng_register 2015-09-21 22:00:38 +08:00
omap-rng.c hwrng: drivers - Use device-managed registration API 2019-08-02 14:44:33 +10:00
omap3-rom-rng.c hwrng: omap3-rom - Handle return value of clk_prepare_enable 2017-05-23 12:52:03 +08:00
optee-rng.c hwrng: make symbol 'optee_rng_id_table' static 2019-02-20 17:58:50 +01:00
pasemi-rng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
pic32-rng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 445 2019-06-05 17:37:18 +02:00
powernv-rng.c hwrng: drivers - Use device-managed registration API 2019-08-02 14:44:33 +10:00
pseries-rng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
s390-trng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 376 2019-06-05 17:37:10 +02:00
st-rng.c hwrng: drivers - Use device-managed registration API 2019-08-02 14:44:33 +10:00
stm32-rng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 110 2019-05-24 17:39:01 +02:00
timeriomem-rng.c hwrng: timeriomem - relax check on memory resource size 2019-09-05 14:37:30 +10:00
tx4939-rng.c hwrng: tx4939 - Use devm_hwrng_register instead of hwrng_register 2016-08-31 23:00:49 +08:00
via-rng.c hwrng: via - support new Centaur CPU 2018-04-21 00:59:03 +08:00
virtio-rng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 102 2019-05-24 17:39:00 +02:00
xgene-rng.c hwrng: drivers - Use device-managed registration API 2019-08-02 14:44:33 +10:00