summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjing zhang <zj.barak@gmail.com>2010-03-13 15:00:45 +0800
committerAvi Kivity <avi@redhat.com>2010-05-17 12:15:36 +0300
commitd57e2c0740bbdd768dcbafe58cf62174f31d7c2d (patch)
tree50ac4407800ec7660f070539d2ac89854280d6ae
parenta87fa35514bcf17aeca97245574e3f735cec9074 (diff)
downloadlinux-3.10-d57e2c0740bbdd768dcbafe58cf62174f31d7c2d.tar.gz
linux-3.10-d57e2c0740bbdd768dcbafe58cf62174f31d7c2d.tar.bz2
linux-3.10-d57e2c0740bbdd768dcbafe58cf62174f31d7c2d.zip
KVM: fix assigned_device_enable_host_msix error handling
Free IRQ's and disable MSIX upon failure. Cc: Avi Kivity <avi@redhat.com> Signed-off-by: Jing Zhang <zj.barak@gmail.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--virt/kvm/assigned-dev.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index 02ff2b19dbe..4d10b1e047f 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