[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/15] s390-virtio: Check for NULL device in reset h
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH 14/15] s390-virtio: Check for NULL device in reset hypercall |
Date: |
Fri, 25 Jan 2013 13:48:57 +0100 |
From: Andreas Färber <address@hidden>
s390_virtio_bus_find_mem() may return a NULL VirtIOS390Device.
If called with, e.g., args[0] == 0, this leads to a segfault.
Fix this by adding error handling as done for other hypercalls.
Present since baf0b55a9e57b909b1f8b0f732c0b10242867418 (Implement
virtio reset).
Signed-off-by: Andreas Färber <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/s390x/s390-virtio.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index a8a489d..2a1d9ac 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -86,6 +86,9 @@ static int s390_virtio_hcall_reset(const uint64_t *args)
VirtIOS390Device *dev;
dev = s390_virtio_bus_find_mem(s390_bus, mem);
+ if (dev == NULL) {
+ return -EINVAL;
+ }
virtio_reset(dev->vdev);
stb_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS, 0);
s390_virtio_device_sync(dev);
--
1.6.0.2
- [Qemu-devel] [PATCH 03/15] s390: Add mapping helper functions., (continued)
[Qemu-devel] [PATCH 10/15] s390: Add new channel I/O based virtio transport., Alexander Graf, 2013/01/25
[Qemu-devel] [PATCH 14/15] s390-virtio: Check for NULL device in reset hypercall,
Alexander Graf <=
[Qemu-devel] [PATCH 11/15] s390: Make typeinfo const, Alexander Graf, 2013/01/25
[Qemu-devel] [PATCH 08/15] s390: Wire up channel I/O in kvm., Alexander Graf, 2013/01/25
[Qemu-devel] [PATCH 12/15] virtio-s390: add a reset function to virtio-s390 devices, Alexander Graf, 2013/01/25
[Qemu-devel] [PATCH 07/15] s390: Virtual channel subsystem support., Alexander Graf, 2013/01/25
[Qemu-devel] [PATCH 09/15] s390-virtio: Factor out some initialization code., Alexander Graf, 2013/01/25
[Qemu-devel] [PATCH 13/15] s390: Move hw files to hw/s390x, Alexander Graf, 2013/01/25
[Qemu-devel] [PATCH 15/15] s390: Add s390-ccw-virtio machine., Alexander Graf, 2013/01/25
Re: [Qemu-devel] [PULL 00/15] s390 patch queue 2013-01-25, Blue Swirl, 2013/01/26