qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-ccw: Indicators fix.
@ 2013-04-23 16:27 Cornelia Huck
  2013-04-23 16:27 ` [Qemu-devel] [PATCH] virtio-ccw: Check indicators location Cornelia Huck
  0 siblings, 1 reply; 2+ messages in thread
From: Cornelia Huck @ 2013-04-23 16:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cornelia Huck

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(+)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Qemu-devel] [PATCH] virtio-ccw: Check indicators location.
  2013-04-23 16:27 [Qemu-devel] [PATCH] virtio-ccw: Indicators fix Cornelia Huck
@ 2013-04-23 16:27 ` Cornelia Huck
  0 siblings, 0 replies; 2+ messages in thread
From: Cornelia Huck @ 2013-04-23 16:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cornelia Huck, qemu-stable

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 |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 56539d3..1c6bd21 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -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;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-23 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23 16:27 [Qemu-devel] [PATCH] virtio-ccw: Indicators fix Cornelia Huck
2013-04-23 16:27 ` [Qemu-devel] [PATCH] virtio-ccw: Check indicators location Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).