From: Avi Kivity Subject: [PATCH 07/20] KVM: ia64: destroy ioapic device if fail to setup default irq routing Date: Wed, 17 Feb 2010 15:45:17 +0200 Message-ID: <1266414330-27444-8-git-send-email-avi@redhat.com> References: <1266414330-27444-1-git-send-email-avi@redhat.com> Cc: linux-kernel@vger.kernel.org To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:12759 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933844Ab0BQNpg (ORCPT ); Wed, 17 Feb 2010 08:45:36 -0500 In-Reply-To: <1266414330-27444-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: From: Wei Yongjun 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 Signed-off-by: Avi Kivity --- arch/ia64/kvm/kvm-ia64.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 0618898..26e0e08 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c @@ -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; -- 1.6.5.3