KVM: ia64: destroy ioapic device if fail to setup default irq routing
authorWei Yongjun <yjwei@cn.fujitsu.com>
Tue, 9 Feb 2010 02:41:56 +0000 (10:41 +0800)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 1 Mar 2010 15:36:10 +0000 (12:36 -0300)
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>
arch/ia64/kvm/kvm-ia64.c

index 06188988ed27f5de8bd43c8f532580a9bd413bf9..26e0e089bfe76b0b89772bfc7f5617abc02d2a9d 100644 (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;