KVM: ia64: destroy ioapic device if fail to setup default irq routing

If KVM_CREATE_IRQCHIP fail due to kvm_setup_default_irq_routing(),
ioapic device is not destroyed and kvm->arch.vioapic is not set to
NULL, this may cause KVM_GET_IRQCHIP and KVM_SET_IRQCHIP access to
unexcepted memory.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
Wei Yongjun 2010-02-09 10:41:56 +08:00 committed by Marcelo Tosatti
parent 72bb2fcd23
commit 4b7bb92100

View file

@ -968,7 +968,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
goto out;
r = kvm_setup_default_irq_routing(kvm);
if (r) {
kfree(kvm->arch.vioapic);
kvm_ioapic_destroy(kvm);
goto out;
}
break;