From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: "Blue Swirl" <blauwirbel@gmail.com>,
"Cornelia Huck" <cornelia.huck@de.ibm.com>,
"Anthony Liguori" <aliguori@us.ibm.com>,
qemu-stable@nongnu.org, "Aurélien Jarno" <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH] virtio-ccw: Check indicators location.
Date: Thu, 25 Apr 2013 11:06:55 +0200 [thread overview]
Message-ID: <1366880815-26431-2-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1366880815-26431-1-git-send-email-cornelia.huck@de.ibm.com>
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 56e4872..b857413 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -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;
--
1.7.9.5
next prev parent reply other threads:[~2013-04-25 9:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-25 9:06 [Qemu-devel] [PULL] virtio-ccw: indicators fix Cornelia Huck
2013-04-25 9:06 ` Cornelia Huck [this message]
-- strict thread matches above, loose matches on Subject: below --
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366880815-26431-2-git-send-email-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).