Skip to contentSkip to conversation

virtio-ccw: indicators fix.

GIT PULL New Cornelia Huck 1 participant 2 messages Apr 25, 2013

lore
Share & tools
lore
#0 lore raw

One bugfix to make sure guests that didn't set up indicators are handled correctly.

Please pull.

The following changes since commit 9953f8822cc316eec9962f0a2858c3439a80adec:

pc: Kill the "use flash device for BIOS unless KVM" misfeature (2013-04-24 13:23:51 -0500)

are available in the git repository at:

git://github.com/cohuck/qemu virtio-ccw-upstr

for you to fetch changes up to 7c4869761d7f2e0a3f806a5359eea5d2473ec5d5:

virtio-ccw: Check indicators location. (2013-04-25 10:43:30 +0200)

Cornelia Huck (1):
virtio-ccw: Check indicators location.

 hw/s390x/virtio-ccw.c |    6 ++++++
 1 file changed, 6 insertions(+)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 virtio-ccw: Check indicators location.

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.

---
 hw/s390x/virtio-ccw.c |    6 ++++++
 1 file changed, 6 insertions(+)
hw/s390x/virtio-ccw.c +6 -0
index 56e4872..b857413 100644
@@ -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;
Signature · 1 line
1.7.9.5