From: jing zhang <[email protected]>

Free IRQ's and disable MSIX upon failure.

Cc: Avi Kivity <[email protected]>
Signed-off-by: Jing Zhang <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>

diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index 057e2cc..47ca447 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -315,12 +315,16 @@ static int assigned_device_enable_host_msix(struct kvm 
*kvm,
                                kvm_assigned_dev_intr, 0,
                                "kvm_assigned_msix_device",
                                (void *)dev);
-               /* FIXME: free requested_irq's on failure */
                if (r)
-                       return r;
+                       goto err;
        }
 
        return 0;
+err:
+       for (i -= 1; i >= 0; i--)
+               free_irq(dev->host_msix_entries[i].vector, (void *)dev);
+       pci_disable_msix(dev->dev);
+       return r;
 }
 
 #endif
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to