mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user