summaryrefslogtreecommitdiffstats
path: root/drivers/hw_random/virtio-rng.c
Commit message (Collapse)AuthorAgeFilesLines
* virtio: implement remove callbacksAhmad Fatoum2021-10-021-0/+6
| | | | | | | | | | | | | | | | | | | | | virtio parent device drivers (e.g. PCI and MMIO) create child devices and free them on remove. The virtio drivers for the child devices (e.g. block and console) however don't unregister with their respective subsystems in the remove callbacks. So these subsystems may have stale pointers pointing at removed devices. This is especially problematic for the console driver, because the virtio console device_d will be removed, but the console itself remains registered leading to a use-after-free as soon as printf is invoked for the previously active console. This leads to a crash when typing reset in https://www.barebox.org/jsbarebox/?graphic=0 Fix this for all virtio drivers. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210916093458.21102-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hw_random: virtio: simplify codeAhmad Fatoum2021-03-011-12/+2
| | | | | | | | | The Linux code did a bit more than we do, but after deleting the unneeded parts virtrng_probe and virtrng_remove do nothing but call probe_common/remove_common. Drop the intermediate functions. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hw_random: add VirtIO RNG driverAhmad Fatoum2021-02-221-0/+120
With this driver enabled, -device virtio-rng-device can now be passed to Qemu for barebox to detect a VirtIO RNG device. If barebox is passed as argument to the Qemu -kernel option, no device tree changes are necessary. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>