diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-09-16 11:34:58 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-10-02 11:16:23 +0200 |
commit | 1c8625aac0d204e567fcee5a8b4e9d0145f011c0 (patch) | |
tree | d02216c2b2e22f9a8817dc2e016636e397c33e9d /include/linux/hw_random.h | |
parent | 41023724b2b09ec1c8555bb32c929a82ebc84359 (diff) | |
download | barebox-1c8625aac0d204e567fcee5a8b4e9d0145f011c0.tar.gz barebox-1c8625aac0d204e567fcee5a8b4e9d0145f011c0.tar.xz |
virtio: implement remove callbacks
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>
Diffstat (limited to 'include/linux/hw_random.h')
-rw-r--r-- | include/linux/hw_random.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index bae442166c..116afd9721 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h @@ -44,4 +44,6 @@ struct hwrng *hwrng_get_first(void); static inline struct hwrng *hwrng_get_first(void) { return ERR_PTR(-ENODEV); }; #endif +void hwrng_unregister(struct hwrng *rng); + #endif /* LINUX_HWRANDOM_H_ */ |