mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
UPSTREAM: KVM: arm64: Free hypervisor allocations if vector slot init fails
Teardown hypervisor mode if vector slot setup fails in order to avoid leaking any allocations done by init_hyp_mode(). Bug: 254441685 Fixes:b881cdce77("KVM: arm64: Allocate hyp vectors statically") Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20221130230934.1014142-18-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit6baaeda878) Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: Id20a219325d0ae7882b7e910f460fc8b5c05f839
This commit is contained in:
committed by
Lee Jones
parent
2f9858326d
commit
391c34feed
@@ -2098,18 +2098,18 @@ int kvm_arch_init(void *opaque)
|
|||||||
err = kvm_init_vector_slots();
|
err = kvm_init_vector_slots();
|
||||||
if (err) {
|
if (err) {
|
||||||
kvm_err("Cannot initialise vector slots\n");
|
kvm_err("Cannot initialise vector slots\n");
|
||||||
goto out_err;
|
goto out_hyp;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = init_subsystems();
|
err = init_subsystems();
|
||||||
if (err)
|
if (err)
|
||||||
goto out_hyp;
|
goto out_subs;
|
||||||
|
|
||||||
if (!in_hyp_mode) {
|
if (!in_hyp_mode) {
|
||||||
err = finalize_hyp_mode();
|
err = finalize_hyp_mode();
|
||||||
if (err) {
|
if (err) {
|
||||||
kvm_err("Failed to finalize Hyp protection\n");
|
kvm_err("Failed to finalize Hyp protection\n");
|
||||||
goto out_hyp;
|
goto out_subs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2123,8 +2123,9 @@ int kvm_arch_init(void *opaque)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_hyp:
|
out_subs:
|
||||||
hyp_cpu_pm_exit();
|
hyp_cpu_pm_exit();
|
||||||
|
out_hyp:
|
||||||
if (!in_hyp_mode)
|
if (!in_hyp_mode)
|
||||||
teardown_hyp_mode();
|
teardown_hyp_mode();
|
||||||
out_err:
|
out_err:
|
||||||
|
|||||||
Reference in New Issue
Block a user