Skip to contentSkip to conversation

virtio-ccw: Indicators fix.

PATCH New Cornelia Huck 1 participant 2 messages Apr 23, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-ccw: Indicators fix.

Hi,

here's another fix for virtio-ccw: We need to check whether an indicator location is actually valid before trying to write to it.

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 56539d3..1c6bd21 100644
@@ -752,10 +752,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