From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcNC8-0006ya-Qa for qemu-devel@nongnu.org; Tue, 14 May 2013 17:55:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UcNC7-0003rw-An for qemu-devel@nongnu.org; Tue, 14 May 2013 17:55:40 -0400 Sender: fluxion From: Michael Roth Date: Tue, 14 May 2013 16:53:02 -0500 Message-Id: <1368568392-2127-6-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1368568392-2127-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1368568392-2127-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 05/15] virtio-ccw: Check indicators location. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, qemu-stable@nongnu.org From: Cornelia Huck 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 (cherry picked from commit 7c4869761d7f2e0a3f806a5359eea5d2473ec5d5) Signed-off-by: Michael Roth --- 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 d92e427..627d11d 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -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; -- 1.7.9.5