From: Greg KH on
2.6.32-stable review patch. If anyone has any objections, please let us know.


From: Wei Yongjun <yjwei(a)>

commit 443c39bc9ef7d8f648408d74c97e943f3bb3f48a upstream.

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.

Signed-off-by: Wei Yongjun <yjwei(a)>
Signed-off-by: Marcelo Tosatti <mtosatti(a)>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)>

arch/x86/kvm/x86.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4766,12 +4766,13 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *
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;
+ kvm_free_lapic(vcpu);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at