]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: fix assigned_device_enable_host_msix error handling
authorjing zhang <zj.barak@gmail.com>
Sat, 13 Mar 2010 07:00:45 +0000 (15:00 +0800)
committerAvi Kivity <avi@redhat.com>
Mon, 17 May 2010 09:15:36 +0000 (12:15 +0300)
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>
virt/kvm/assigned-dev.c

index 02ff2b19dbe242a5033da435998a19f1fc4e52ed..4d10b1e047f4e9b3c3c22df98b25be6d23247e12 100644 (file)
@@ -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