qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] fix segfault in msix_save
       [not found] <cover.1246448461.git.mst@redhat.com>
@ 2009-07-01 11:50 ` Michael S. Tsirkin
  2009-07-01 12:27   ` [Qemu-devel] " Kevin Wolf
  2009-07-01 11:50 ` [Qemu-devel] [PATCH 2/2] qemu: fix up load for msi-x Michael S. Tsirkin
  1 sibling, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2009-07-01 11:50 UTC (permalink / raw)
  To: qemu-devel, avi, kvm, aliguori, kwolf

This fixes segfault reported by Kevin Wolf,
and simplifies the code in msix_save.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/msix.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/msix.c b/hw/msix.c
index 4ab6da6..98c62a5 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -284,11 +284,13 @@ int msix_uninit(PCIDevice *dev)
 
 void msix_save(PCIDevice *dev, QEMUFile *f)
 {
-    unsigned nentries = (pci_get_word(dev->config + PCI_MSIX_FLAGS) &
-                         PCI_MSIX_FLAGS_QSIZE) + 1;
-    qemu_put_buffer(f, dev->msix_table_page, nentries * MSIX_ENTRY_SIZE);
-    qemu_put_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING,
-                    (nentries + 7) / 8);
+    unsigned n = dev->msix_entries_nr;
+
+    if (!dev->cap_present & QEMU_PCI_CAP_MSIX)
+        return;
+
+    qemu_put_buffer(f, dev->msix_table_page, n * MSIX_ENTRY_SIZE);
+    qemu_put_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8);
 }
 
 /* Should be called after restoring the config space. */
-- 
1.6.2.2

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

* [Qemu-devel] [PATCH 2/2] qemu: fix up load for msi-x
       [not found] <cover.1246448461.git.mst@redhat.com>
  2009-07-01 11:50 ` [Qemu-devel] [PATCH 1/2] fix segfault in msix_save Michael S. Tsirkin
@ 2009-07-01 11:50 ` Michael S. Tsirkin
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2009-07-01 11:50 UTC (permalink / raw)
  To: qemu-devel, avi, kvm, aliguori, kwolf

Add missing load of control vector in virtio

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/virtio.c b/hw/virtio.c
index 843be86..e9dd7a0 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -665,6 +665,9 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
     vdev->config_len = qemu_get_be32(f);
     qemu_get_buffer(f, vdev->config, vdev->config_len);
 
+    if (vdev->nvectors)
+        qemu_get_be16s(f, &vdev->config_vector);
+
     num = qemu_get_be32(f);
 
     for (i = 0; i < num; i++) {
-- 
1.6.2.2

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

* [Qemu-devel] Re: [PATCH 1/2] fix segfault in msix_save
  2009-07-01 11:50 ` [Qemu-devel] [PATCH 1/2] fix segfault in msix_save Michael S. Tsirkin
@ 2009-07-01 12:27   ` Kevin Wolf
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2009-07-01 12:27 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: aliguori, qemu-devel, kvm, avi

Michael S. Tsirkin schrieb:
> This fixes segfault reported by Kevin Wolf,
> and simplifies the code in msix_save.
> 
> Reported-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

I can confirm that this fixes the segfault for me.

Kevin

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

end of thread, other threads:[~2009-07-01 12:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1246448461.git.mst@redhat.com>
2009-07-01 11:50 ` [Qemu-devel] [PATCH 1/2] fix segfault in msix_save Michael S. Tsirkin
2009-07-01 12:27   ` [Qemu-devel] " Kevin Wolf
2009-07-01 11:50 ` [Qemu-devel] [PATCH 2/2] qemu: fix up load for msi-x Michael S. Tsirkin

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).