From d57e2c0740bbdd768dcbafe58cf62174f31d7c2d Mon Sep 17 00:00:00 2001 From: jing zhang Date: Sat, 13 Mar 2010 15:00:45 +0800 Subject: [PATCH] KVM: fix assigned_device_enable_host_msix error handling Free IRQ's and disable MSIX upon failure. Cc: Avi Kivity Signed-off-by: Jing Zhang Signed-off-by: Marcelo Tosatti --- virt/kvm/assigned-dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 02ff2b19dbe2..4d10b1e047f4 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c @@ -316,12 +316,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 -- 2.34.1