[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] vfio-pci: Fix missing unparent of dynamically allocated MemoryRegion



commit 4d49de6b6f9b45446dd31990a177b13953f2e842
Author:     Alex Williamson <alex.williamson@xxxxxxxxxx>
AuthorDate: Wed Feb 4 11:45:32 2015 -0700
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Mon Feb 23 18:04:34 2015 -0600

    vfio-pci: Fix missing unparent of dynamically allocated MemoryRegion
    
    Commit d8d95814609e added explicit object_unparent() calls for
    dynamically allocated MemoryRegions.  The VFIOMSIXInfo structure also
    contains such a MemoryRegion, covering the mmap'd region of a PCI BAR
    above the MSI-X table.  This structure is freed as part of the class
    exit function and therefore also needs an explicit object_unparent().
    Failing to do this results in random segfaults due to fields within
    the structure, often the class pointer, being reclaimed and corrupted
    by the time object_finalize_child_property() is called for the object.
    
    Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
    Reviewed-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    Cc: qemu-stable@xxxxxxxxxx # 2.2
    (cherry picked from commit 3a4dbe6aa934370a92372528c1255ee1504965ee)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 hw/misc/vfio.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index fd318a1..7bff62c 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -4049,6 +4049,7 @@ static void vfio_put_device(VFIODevice *vdev)
     DPRINTF("vfio_put_device: close vdev->fd\n");
     close(vdev->fd);
     if (vdev->msix) {
+        object_unparent(OBJECT(&vdev->msix->mmap_mem));
         g_free(vdev->msix);
         vdev->msix = NULL;
     }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.