]> xenbits.xensource.com Git - qemu-upstream-4.4-testing.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)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Thu, 25 Apr 2013 08:43:30 +0000 (10:43 +0200)
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>
hw/s390x/virtio-ccw.c

index 56e4872e11a3b086411c1e0813173bd5eba99b1c..b857413fa4e93ff8526390e30773f52acd6d48e7 100644 (file)
@@ -742,10 +742,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;