]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
virt/kvm/assigned-dev.c: Set 'dev->irq_source_id' to '-1' after free it
authorChen Gang <gang.chen.5i5j@gmail.com>
Fri, 8 Aug 2014 15:37:59 +0000 (23:37 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 19 Aug 2014 13:12:28 +0000 (15:12 +0200)
As a generic function, deassign_guest_irq() assumes it can be called
even if assign_guest_irq() is not be called successfully (which can be
triggered by ioctl from user mode, indirectly).

So for assign_guest_irq() failure process, need set 'dev->irq_source_id'
to -1 after free 'dev->irq_source_id', or deassign_guest_irq() may free
it again.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/assigned-dev.c

index bf06577fea51c22ab944edb9560e56f01aae2f94..5819a2708d7edd5823d9e5885a6b7c3796b387ad 100644 (file)
@@ -526,8 +526,10 @@ static int assign_guest_irq(struct kvm *kvm,
                dev->irq_requested_type |= guest_irq_type;
                if (dev->ack_notifier.gsi != -1)
                        kvm_register_irq_ack_notifier(kvm, &dev->ack_notifier);
-       } else
+       } else {
                kvm_free_irq_source_id(kvm, dev->irq_source_id);
+               dev->irq_source_id = -1;
+       }
 
        return r;
 }