ANDROID: KVM: arm64: Fix error path in pkvm_mem_abort()
On one error path, pin_user_pages has succeeded and should be undone. Bug: 310131277 Change-Id: I92fe0c54bb5b8005f848491f5e9be1090b61fbd1 Signed-off-by: Keir Fraser <keirf@google.com>
This commit is contained in:
parent
22e9166465
commit
825c17428a
1 changed files with 4 additions and 3 deletions
|
|
@ -1388,7 +1388,7 @@ static int pkvm_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
|
|||
* prevent try_to_unmap() from succeeding.
|
||||
*/
|
||||
ret = -EIO;
|
||||
goto dec_account;
|
||||
goto unpin;
|
||||
}
|
||||
|
||||
write_lock(&kvm->mmu_lock);
|
||||
|
|
@ -1397,7 +1397,7 @@ static int pkvm_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
|
|||
if (ret) {
|
||||
if (ret == -EAGAIN)
|
||||
ret = 0;
|
||||
goto unpin;
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
ppage->page = page;
|
||||
|
|
@ -1407,8 +1407,9 @@ static int pkvm_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
|
|||
|
||||
return 0;
|
||||
|
||||
unpin:
|
||||
unlock:
|
||||
write_unlock(&kvm->mmu_lock);
|
||||
unpin:
|
||||
unpin_user_pages(&page, 1);
|
||||
dec_account:
|
||||
account_locked_vm(mm, 1, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue