aboutsummaryrefslogtreecommitdiff
path: root/hw/misc/imx_rngc.c
diff options
context:
space:
mode:
authorAlexander Bulekov <alxndr@bu.edu>2023-04-27 17:10:09 -0400
committerThomas Huth <thuth@redhat.com>2023-04-28 11:31:54 +0200
commitf63192b0544af5d3e4d5edfd85ab520fcf671377 (patch)
tree64eab41f7be16e93518b18c885d7e082edec4f69 /hw/misc/imx_rngc.c
parentef56ffbdd6b0605dc1e305611287b948c970e236 (diff)
downloadqemu-f63192b0544af5d3e4d5edfd85ab520fcf671377.zip
qemu-f63192b0544af5d3e4d5edfd85ab520fcf671377.tar.gz
qemu-f63192b0544af5d3e4d5edfd85ab520fcf671377.tar.bz2
hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
This protects devices from bh->mmio reentrancy issues. Thanks: Thomas Huth <thuth@redhat.com> for diagnosing OS X test failure. Signed-off-by: Alexander Bulekov <alxndr@bu.edu> Reviewed-by: Darren Kenny <darren.kenny@oracle.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Paul Durrant <paul@xen.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20230427211013.2994127-5-alxndr@bu.edu> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'hw/misc/imx_rngc.c')
-rw-r--r--hw/misc/imx_rngc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/misc/imx_rngc.c b/hw/misc/imx_rngc.c
index 632c037..082c698 100644
--- a/hw/misc/imx_rngc.c
+++ b/hw/misc/imx_rngc.c
@@ -228,8 +228,10 @@ static void imx_rngc_realize(DeviceState *dev, Error **errp)
sysbus_init_mmio(sbd, &s->iomem);
sysbus_init_irq(sbd, &s->irq);
- s->self_test_bh = qemu_bh_new(imx_rngc_self_test, s);
- s->seed_bh = qemu_bh_new(imx_rngc_seed, s);
+ s->self_test_bh = qemu_bh_new_guarded(imx_rngc_self_test, s,
+ &dev->mem_reentrancy_guard);
+ s->seed_bh = qemu_bh_new_guarded(imx_rngc_seed, s,
+ &dev->mem_reentrancy_guard);
}
static void imx_rngc_reset(DeviceState *dev)