Commit ce6bd2bd authored by Sean Christopherson's avatar Sean Christopherson Committed by Khalid Elmously

KVM: PPC: Book3S PR: Free shared page if mmu initialization fails

BugLink: https://bugs.launchpad.net/bugs/1864775

commit cb10bf91 upstream.

Explicitly free the shared page if kvmppc_mmu_init() fails during
kvmppc_core_vcpu_create(), as the page is freed only in
kvmppc_core_vcpu_free(), which is not reached via kvm_vcpu_uninit().

Fixes: 96bc451a ("KVM: PPC: Introduce shared page")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Acked-by: default avatarPaul Mackerras <paulus@ozlabs.org>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 74655e1e
......@@ -1444,10 +1444,12 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_pr(struct kvm *kvm,
err = kvmppc_mmu_init(vcpu);
if (err < 0)
goto uninit_vcpu;
goto free_shared_page;
return vcpu;
free_shared_page:
free_page((unsigned long)vcpu->arch.shared);
uninit_vcpu:
kvm_vcpu_uninit(vcpu);
free_shadow_vcpu:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment