57 lines
2.1 KiB
Diff
57 lines
2.1 KiB
Diff
|
From 83b492d20071da90611d0ba5b028a80a49211eb3 Mon Sep 17 00:00:00 2001
|
||
|
From: Markus Armbruster <armbru@redhat.com>
|
||
|
Date: Mon, 3 Dec 2018 16:12:10 +0000
|
||
|
Subject: [PATCH 09/16] vfio-helpers: Fix qemu_vfio_open_pci() crash
|
||
|
|
||
|
RH-Author: Markus Armbruster <armbru@redhat.com>
|
||
|
Message-id: <20181203161210.8577-2-armbru@redhat.com>
|
||
|
Patchwork-id: 83214
|
||
|
O-Subject: [RHEL8/rhel qemu-kvm PATCH 1/1] vfio-helpers: Fix qemu_vfio_open_pci() crash
|
||
|
Bugzilla: 1645840
|
||
|
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
||
|
RH-Acked-by: John Snow <jsnow@redhat.com>
|
||
|
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||
|
|
||
|
qemu_vfio_open_common() initializes s->lock only after passing s to
|
||
|
qemu_vfio_dma_map() via qemu_vfio_init_ramblock().
|
||
|
qemu_vfio_dma_map() tries to lock the uninitialized lock and crashes.
|
||
|
|
||
|
Fix by initializing s->lock first.
|
||
|
|
||
|
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1645840
|
||
|
Fixes: 418026ca43bc2626db092d7558258f9594366f28
|
||
|
Cc: qemu-stable@nongnu.org
|
||
|
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
||
|
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
||
|
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||
|
Message-id: 20181127084143.1113-1-armbru@redhat.com
|
||
|
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||
|
(cherry picked from commit 549b50a31d28f2687a47e827a1e17300784a2c44)
|
||
|
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||
|
---
|
||
|
util/vfio-helpers.c | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
|
||
|
index 006674c..c595faf 100644
|
||
|
--- a/util/vfio-helpers.c
|
||
|
+++ b/util/vfio-helpers.c
|
||
|
@@ -411,13 +411,13 @@ static int qemu_vfio_init_ramblock(const char *block_name, void *host_addr,
|
||
|
|
||
|
static void qemu_vfio_open_common(QEMUVFIOState *s)
|
||
|
{
|
||
|
+ qemu_mutex_init(&s->lock);
|
||
|
s->ram_notifier.ram_block_added = qemu_vfio_ram_block_added;
|
||
|
s->ram_notifier.ram_block_removed = qemu_vfio_ram_block_removed;
|
||
|
ram_block_notifier_add(&s->ram_notifier);
|
||
|
s->low_water_mark = QEMU_VFIO_IOVA_MIN;
|
||
|
s->high_water_mark = QEMU_VFIO_IOVA_MAX;
|
||
|
qemu_ram_foreach_block(qemu_vfio_init_ramblock, s);
|
||
|
- qemu_mutex_init(&s->lock);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
--
|
||
|
1.8.3.1
|
||
|
|