[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 66/97] vfio-helpers: Fix qemu_vfio_open_pci() crash
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 66/97] vfio-helpers: Fix qemu_vfio_open_pci() crash |
Date: |
Mon, 1 Apr 2019 15:59:40 -0500 |
From: Markus Armbruster <address@hidden>
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: address@hidden
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
(cherry picked from commit 549b50a31d28f2687a47e827a1e17300784a2c44)
Signed-off-by: Michael Roth <address@hidden>
---
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 1d9272efa4..cccc9cd42e 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);
}
/**
--
2.17.1
- [Qemu-stable] [PATCH 45/97] ne2000: fix possible out of bound access in ne2000_receive, (continued)
- [Qemu-stable] [PATCH 45/97] ne2000: fix possible out of bound access in ne2000_receive, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 50/97] virtio: do not take address of packed members, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 56/97] nbd: fix NBD_FLAG_SEND_CACHE value, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 58/97] vhost-scsi: prevent using uninitialized vqs, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 59/97] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 04/97] target/arm: Fix typo in helper_sve_movz_d, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 64/97] qemu-img: Fix leak, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 66/97] vfio-helpers: Fix qemu_vfio_open_pci() crash,
Michael Roth <=
- [Qemu-stable] [PATCH 69/97] nbd/server: Advertise all contexts in response to bare LIST, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 70/97] nbd/client: Make x-dirty-bitmap more reliable, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 71/97] nbd/client: Send NBD_CMD_DISC if open fails after connect, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 73/97] iotests: simple mirror test with kvm on 1G image, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 68/97] i2c: Add a length check to the SMBus write handling, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 76/97] pcie: set link state inactive/active after hot unplug/plug, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 75/97] Changes requirement for "vsubsbs" instruction, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 79/97] linux-user: write(fd, NULL, 0) parity with linux's treatment of same, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 80/97] linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0, Michael Roth, 2019/04/01
- [Qemu-stable] [PATCH 82/97] exec.c: Don't reallocate IOMMUNotifiers that are in use, Michael Roth, 2019/04/01