summaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorjing zhang <zj.barak@gmail.com>2010-03-13 08:00:45 +0100
committerAvi Kivity <avi@redhat.com>2010-05-17 11:15:36 +0200
commitd57e2c0740bbdd768dcbafe58cf62174f31d7c2d (patch)
tree50ac4407800ec7660f070539d2ac89854280d6ae /virt/kvm
parentKVM: fix the errno of ioctl KVM_[UN]REGISTER_COALESCED_MMIO failure (diff)
downloadlinux-d57e2c0740bbdd768dcbafe58cf62174f31d7c2d.tar.xz
linux-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>
Diffstat (limited to 'virt/kvm')
-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 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