From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: kvm@vger.kernel.org, Avi Kivity <avi@redhat.com>
Subject: [PATCH 2/2] KVM: x86: Fix leak of free lapic date in kvm_arch_vcpu_init()
Date: Fri, 22 Jan 2010 14:21:29 +0800 [thread overview]
Message-ID: <4B5943E9.6040207@cn.fujitsu.com> (raw)
In-Reply-To: <4B594347.2010904@cn.fujitsu.com>
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@cn.fujitsu.com>
---
arch/x86/kvm/x86.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 6651dbf..f25b52e 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:
--
1.6.2.2
next prev parent reply other threads:[~2010-01-22 6:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-22 6:18 [PATCH 1/2] KVM: x86: Fix probable memory leak of vcpu->arch.mce_banks Wei Yongjun
2010-01-22 6:21 ` Wei Yongjun [this message]
2010-01-22 6:41 ` [PATCH 1/2 v2] " Wei Yongjun
2010-01-22 8:55 ` [PATCH] KVM: MMU: Remove some useless code from alloc_mmu_pages() Wei Yongjun
2010-01-23 19:23 ` Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B5943E9.6040207@cn.fujitsu.com \
--to=yjwei@cn.fujitsu.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox