android_kernel_google_msm/drivers
Laurent Vivier fda3f8e888 hwrng: core - don't wait on add_early_randomness()
commit 78887832e76541f77169a24ac238fccb51059b63 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iaa47b1d5351140ecc8137441979a88c258ef8f38
2023-03-24 20:53:03 +01:00
..
accessibility
acpi ACPI: Use correct IRQ when uninstalling ACPI interrupt handler 2016-10-26 23:15:26 +08:00
amba
ata sata_sil: disable trim 2016-10-26 23:15:34 +08:00
atm
auxdisplay auxdisplay: ks0108: fix refcount 2016-04-27 18:55:15 +08:00
base mm: export NR_SHMEM via sysinfo(2) / si_meminfo() interfaces 2020-12-01 19:08:36 +01:00
bcma
block UPSTREAM: block: disable entropy contributions for nonrot devices 2018-01-01 22:06:21 +03:00
bluetooth Bluetooth: ath3k: Add support of AR3012 0cf3:817b device 2016-10-26 23:15:25 +08:00
cdrom
char hwrng: core - don't wait on add_early_randomness() 2023-03-24 20:53:03 +01:00
clk Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
clocksource sched_clock: Squashed revert of the latest updates 2018-02-20 21:56:17 +03:00
connector
coresight
cpufreq Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
cpuidle
crypto Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
dca
devfreq
dio
dma dmaengine: mv_xor: bug fix for racing condition in descriptors cleanup 2015-10-22 09:20:04 +08:00
edac EDAC, ppc4xx: Access mci->csrows array elements properly 2016-03-21 09:17:52 +08:00
eisa
firewire firewire: ohci: fix JMicron JMB38x IT context discovery 2016-10-26 23:15:27 +08:00
firmware
gpio Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
gpu ion: cma: Update print_debug function 2018-08-27 14:52:43 +00:00
hid Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
hsi
hv Drivers: hv: vmbus: Don't wait after requesting offers 2015-09-18 09:20:26 +08:00
hwmon Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
hwspinlock
i2c Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
ide UPSTREAM: block: disable entropy contributions for nonrot devices 2018-01-01 22:06:21 +03:00
idle
ieee802154
infiniband Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
input enable/disable the lid sensor 2019-03-19 08:57:18 +01:00
iommu iommu: msm: Handle unmapping of PTE properly 2018-08-27 14:52:32 +00:00
isdn ser_gigaset: use container_of() instead of detour 2016-10-26 23:15:46 +08:00
leds Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
lguest lguest: fix out-by-one error in address checking. 2015-09-18 09:20:43 +08:00
macintosh windfarm: decrement client count when unregistering 2016-04-27 18:55:15 +08:00
mca
md dm-crypt: run in a WQ_HIGHPRI workqueue 2018-01-13 17:13:45 +03:00
media gpu: ion: Add support for sharing buffers with dma buf kernel handles 2018-08-27 14:52:38 +00:00
memstick memstick: mspro_block: add missing curly braces 2015-09-18 09:20:31 +08:00
message
mfd Sound Control: (Optional) work around for WCD93xx audio issues 2019-03-16 12:46:51 +01:00
misc Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
mmc mmc: move to a SCHED_FIFO thread 2018-01-13 17:13:45 +03:00
mtd UPSTREAM: block: disable entropy contributions for nonrot devices 2018-01-01 22:06:21 +03:00
net net: Replace u64_stats_fetch_begin_bh to u64_stats_fetch_begin_irq 2020-11-30 19:26:49 +03:00
nfc Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
nubus
of Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
oprofile Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
parisc parisc iommu: fix panic due to trying to allocate too large region 2016-10-26 23:15:37 +08:00
parport
pci Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
pcmcia Disable write buffering on Toshiba ToPIC95 2015-10-22 09:20:04 +08:00
pinctrl
platform msm: sps: Fix race condition in SPS debugfs APIs 2018-02-16 20:15:07 -07:00
pnp
power otg+charge: detect charging while OTG enabled 2018-04-04 10:19:45 +02:00
pps
ps3
ptp
rapidio
regulator Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
remoteproc Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
rpmsg
rtc Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
s390 s390/3215: fix tty output containing tabs 2015-04-14 17:34:03 +08:00
sbus bbc-i2c: Fix BBC I2C envctrl on SunBlade 2000 2014-08-14 08:42:37 +08:00
scsi ANDROID: scsi: Add segment checking in sg_read 2018-01-13 17:13:38 +03:00
sfi
sh
slimbus
sn
spi Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
spmi
ssb
staging flo/deb: Update Android binder 2021-11-26 22:02:17 +01:00
switch
target Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
tc
thermal Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
tty Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
uio Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
usb Merge branch 'lineage-18.1' into followmsi-11 2020-12-19 13:42:14 +01:00
uwb uwb: init beacon cache entry before registering uwb device 2014-12-01 18:02:28 +08:00
vhost vhost: actually track log eventfd file 2016-03-21 09:17:49 +08:00
video msm: vidc: prevent vcd_stop to wait for long 2018-08-27 14:52:38 +00:00
virt
virtio Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
vlynq
w1
watchdog watchdog: omap: assert the counter being stopped before reprogramming 2015-10-22 09:20:06 +08:00
xen Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
zorro
Kconfig msm: gud: Remove gud driver 2018-01-13 17:13:39 +03:00
Makefile msm: gud: Remove gud driver 2018-01-13 17:13:39 +03:00