diff options
author | Mark McLoughlin <markmc@redhat.com> | 2008-12-01 08:57:47 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-31 09:55:06 -0500 |
commit | f29b2673d3fc7ae38ec22922e9cdc75ee37386b5 (patch) | |
tree | 8e6a76addf0f35382525a68971faf3f108a09887 /virt/kvm | |
parent | fdd897e6b5253a45b633f7d334cf3e150bbaf386 (diff) |
KVM: don't free an unallocated irq source id
Set assigned_dev->irq_source_id to -1 so that we can avoid freeing
a source ID which we never allocated.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r-- | virt/kvm/kvm_main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 8dab7cedd50b..63fd88209439 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -210,7 +210,10 @@ static void kvm_free_assigned_device(struct kvm *kvm, | |||
210 | pci_disable_msi(assigned_dev->dev); | 210 | pci_disable_msi(assigned_dev->dev); |
211 | 211 | ||
212 | kvm_unregister_irq_ack_notifier(&assigned_dev->ack_notifier); | 212 | kvm_unregister_irq_ack_notifier(&assigned_dev->ack_notifier); |
213 | kvm_free_irq_source_id(kvm, assigned_dev->irq_source_id); | 213 | |
214 | if (assigned_dev->irq_source_id != -1) | ||
215 | kvm_free_irq_source_id(kvm, assigned_dev->irq_source_id); | ||
216 | assigned_dev->irq_source_id = -1; | ||
214 | 217 | ||
215 | if (cancel_work_sync(&assigned_dev->interrupt_work)) | 218 | if (cancel_work_sync(&assigned_dev->interrupt_work)) |
216 | /* We had pending work. That means we will have to take | 219 | /* We had pending work. That means we will have to take |
@@ -466,7 +469,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
466 | match->host_busnr = assigned_dev->busnr; | 469 | match->host_busnr = assigned_dev->busnr; |
467 | match->host_devfn = assigned_dev->devfn; | 470 | match->host_devfn = assigned_dev->devfn; |
468 | match->dev = dev; | 471 | match->dev = dev; |
469 | 472 | match->irq_source_id = -1; | |
470 | match->kvm = kvm; | 473 | match->kvm = kvm; |
471 | 474 | ||
472 | list_add(&match->list, &kvm->arch.assigned_dev_head); | 475 | list_add(&match->list, &kvm->arch.assigned_dev_head); |