]> git.proxmox.com Git - mirror_qemu.git/commitdiff
pci-assign: Fix a bug when map MSI-X table memory failed
authorGonglei <arei.gonglei@huawei.com>
Thu, 3 Apr 2014 05:18:23 +0000 (13:18 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 13 May 2014 11:12:04 +0000 (13:12 +0200)
When mmapping memory for the MSI-X table failsthe dev->msix_table is
not set to NULL and assigned_dev_unregister_msix_mmio() will cause
a segfault when trying to munmap it.

Signed-off-by: Gonglei Arei <arei.gonglei@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
hw/i386/kvm/pci-assign.c

index e55421adcd75568d34a8c1382f625988c2d6e3fd..0572821f2102496783b39ed6bea3a116156cf45b 100644 (file)
@@ -1664,6 +1664,7 @@ static void assigned_dev_register_msix_mmio(AssignedDevice *dev, Error **errp)
                            MAP_ANONYMOUS|MAP_PRIVATE, 0, 0);
     if (dev->msix_table == MAP_FAILED) {
         error_setg_errno(errp, errno, "failed to allocate msix_table");
+        dev->msix_table = NULL;
         return;
     }