From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Alexander Graf <agraf@suse.de>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH for v1.0 2/3] msix: Prevent bogus mask updates on MMIO accesses
Date: Mon, 21 Nov 2011 18:57:31 +0200 [thread overview]
Message-ID: <bfe66ce6238666cd16056828085c960c955925bd.1321893802.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1321893802.git.mst@redhat.com>
>From: Jan Kiszka <jan.kiszka@siemens.com>
Only accesses to the MSI-X table must trigger a call to
msix_handle_mask_update, otherwise the vector
value might be out of range.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/msix.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index 63b41b9..2969601 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -176,6 +176,12 @@ static void msix_mmio_write(void *opaque, target_phys_addr_t addr,
PCIDevice *dev = opaque;
unsigned int offset = addr & (MSIX_PAGE_SIZE - 1) & ~0x3;
int vector = offset / PCI_MSIX_ENTRY_SIZE;
+
+ /* MSI-X page includes a read-only PBA and a writeable Vector Control. */
+ if (vector >= dev->msix_entries_nr) {
+ return;
+ }
+
pci_set_long(dev->msix_table_page + offset, val);
msix_handle_mask_update(dev, vector);
}
--
1.7.5.53.gc233e
next prev parent reply other threads:[~2011-11-21 16:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-21 16:56 [Qemu-devel] [PATCH for v1.0 0/3] msix: fixes for 1.0 Michael S. Tsirkin
2011-11-21 16:57 ` [Qemu-devel] [PATCH for v1.0 1/3] msix: track function masked in pci device state Michael S. Tsirkin
2011-12-02 23:34 ` Cam Macdonell
2011-12-03 10:46 ` Jan Kiszka
2011-12-04 10:08 ` Michael S. Tsirkin
2011-12-04 10:20 ` Michael S. Tsirkin
2011-12-04 12:35 ` Jan Kiszka
2011-12-04 13:03 ` Michael S. Tsirkin
2011-12-04 23:47 ` Cam Macdonell
2011-12-05 9:08 ` Michael S. Tsirkin
2011-12-05 19:25 ` Cam Macdonell
2011-12-05 19:48 ` [Qemu-devel] [PATCH master/v1.0.x] ivshmem: add missing msix calls Michael S. Tsirkin
2012-01-13 22:43 ` Cam Macdonell
2012-01-15 18:15 ` Andreas Färber
2011-11-21 16:57 ` Michael S. Tsirkin [this message]
2011-11-21 16:57 ` [Qemu-devel] [PATCH for v1.0 3/3] msix: avoid mask updates if mask is unchanged Michael S. Tsirkin
2011-11-22 0:23 ` [Qemu-devel] [PATCH for v1.0 0/3] msix: fixes for 1.0 Anthony Liguori
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=bfe66ce6238666cd16056828085c960c955925bd.1321893802.git.mst@redhat.com \
--to=mst@redhat.com \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=qemu-devel@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).