summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-10-29 18:44:17 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2010-01-29 02:02:50 +0300
commit454f8b167c06886ab7d469c889d9cca613398431 (patch)
tree7f2217e999b2650a80145a1d5460c42c0baa32c1
parenteaccd490b0128d11ce2ea4d9d89e092661ae90b5 (diff)
downloadlinux-454f8b167c06886ab7d469c889d9cca613398431.tar.xz
KVM: only clear irq_source_id if irqchip is present
commit e50212bb51356f0df48d6cce0aae5acf41df336d upstream. Otherwise kvm might attempt to dereference a NULL pointer. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--virt/kvm/irq_comm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index ddc388e565fc..5288885637b1 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -233,9 +233,12 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
goto unlock;
}
+ clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
+ if (!irqchip_in_kernel(kvm))
+ goto unlock;
+
for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++)
clear_bit(irq_source_id, &kvm->arch.irq_states[i]);
- clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
unlock:
mutex_unlock(&kvm->irq_lock);
}