提交 36cb93fd 编写于 作者: W Wei Yongjun 提交者: Marcelo Tosatti

KVM: x86: Fix probable memory leak of vcpu->arch.mce_banks

vcpu->arch.mce_banks is malloc in kvm_arch_vcpu_init(), but
never free in any place, this may cause memory leak. So this
patch fixed to free it in kvm_arch_vcpu_uninit().

Cc: stable@kernel.org
Signed-off-by: NWei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
上级 062d5e9b
...@@ -5088,6 +5088,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) ...@@ -5088,6 +5088,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
{ {
kfree(vcpu->arch.mce_banks);
kvm_free_lapic(vcpu); kvm_free_lapic(vcpu);
down_read(&vcpu->kvm->slots_lock); down_read(&vcpu->kvm->slots_lock);
kvm_mmu_destroy(vcpu); kvm_mmu_destroy(vcpu);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册