]> git.proxmox.com Git - qemu.git/commitdiff
virtio-ccw: Check indicators location.
authorCornelia Huck <cornelia.huck@de.ibm.com>
Tue, 23 Apr 2013 15:15:19 +0000 (17:15 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 13 May 2013 16:53:19 +0000 (11:53 -0500)
If a guest neglected to register (secondary) indicators but still runs
with notifications enabled, we might end up writing to guest zero;
avoid this by checking for valid indicators and only writing to the
guest and generating an interrupt if indicators have been setup.

Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
(cherry picked from commit 7c4869761d7f2e0a3f806a5359eea5d2473ec5d5)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/s390x/virtio-ccw.c

index d92e42735cf56bf9d77f991f9d4ef7b99ba45634..627d11d76237ef8ffde1a105c972021a9802f9f2 100644 (file)
@@ -662,10 +662,16 @@ static void virtio_ccw_notify(DeviceState *d, uint16_t vector)
     }
 
     if (vector < VIRTIO_PCI_QUEUE_MAX) {
+        if (!dev->indicators) {
+            return;
+        }
         indicators = ldq_phys(dev->indicators);
         indicators |= 1ULL << vector;
         stq_phys(dev->indicators, indicators);
     } else {
+        if (!dev->indicators2) {
+            return;
+        }
         vector = 0;
         indicators = ldq_phys(dev->indicators2);
         indicators |= 1ULL << vector;