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