ANDROID: KVM: arm64: Avoid unnecessary unmap walk in MEM_RELINQUISH hypercall

If the mapping is determined to be not present in an earlier walk,
attempting the unmap is pointless.

Bug: 259217067
Change-Id: I6fd939556b80d7a9a0731cab36166a652f7a7c6d
Signed-off-by: Keir Fraser <keirf@google.com>
This commit is contained in:
Keir Fraser
2022-11-16 10:53:00 +00:00
parent a75533eb44
commit 2e85fe731a

View File

@@ -372,7 +372,7 @@ int __pkvm_guest_relinquish_to_host(struct pkvm_hyp_vcpu *vcpu,
ret = kvm_pgtable_walk(&vm->pgt, ipa, PAGE_SIZE, &walker);
/* Zap the guest stage2 pte. */
if (!ret)
if (!ret && data.pa)
kvm_pgtable_stage2_unmap(&vm->pgt, ipa, PAGE_SIZE);
guest_unlock_component(vm);