summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@cn.fujitsu.com>2010-01-22 07:21:29 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2010-01-25 15:26:40 +0100
commit443c39bc9ef7d8f648408d74c97e943f3bb3f48a (patch)
treeea4b29635cd1caee726c1c1c950ac0b10804d6ce /arch/x86/kvm/x86.c
parentKVM: x86: Fix probable memory leak of vcpu->arch.mce_banks (diff)
downloadlinux-443c39bc9ef7d8f648408d74c97e943f3bb3f48a.tar.xz
linux-443c39bc9ef7d8f648408d74c97e943f3bb3f48a.zip
KVM: x86: Fix leak of free lapic date in kvm_arch_vcpu_init()
In function kvm_arch_vcpu_init(), if the memory malloc for vcpu->arch.mce_banks is fail, it does not free the memory of lapic date. This patch fixed it. Cc: stable@kernel.org Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to '')
-rw-r--r--arch/x86/kvm/x86.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b265eecc741f..1ddcad452add 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5072,12 +5072,13 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
GFP_KERNEL);
if (!vcpu->arch.mce_banks) {
r = -ENOMEM;
- goto fail_mmu_destroy;
+ goto fail_free_lapic;
}
vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS;
return 0;
-
+fail_free_lapic:
+ kvm_free_lapic(vcpu);
fail_mmu_destroy:
kvm_mmu_destroy(vcpu);
fail_free_pio_data: