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: 357781595
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 37beb891b9
commit 0004939009
+1 -1
View File
@@ -378,7 +378,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);