summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Gang <gang.chen.5i5j@gmail.com>2014-08-08 23:37:59 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2014-08-19 15:12:28 +0200
commit30d1e0e806e5b2fadc297ba78f2d7afd6ba309cf (patch)
tree4391c372692bdc139411f68400ba950d47f852c2
parent0d234daf7e0a3290a3a20c8087eefbd6335a5bd4 (diff)
downloadop-kernel-dev-30d1e0e806e5b2fadc297ba78f2d7afd6ba309cf.zip
op-kernel-dev-30d1e0e806e5b2fadc297ba78f2d7afd6ba309cf.tar.gz
virt/kvm/assigned-dev.c: Set 'dev->irq_source_id' to '-1' after free it
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>
-rw-r--r--virt/kvm/assigned-dev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index bf06577..5819a27 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -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;
}
OpenPOWER on IntegriCloud