diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index da6da386b59189d2e224b8f3c7b60a399cad58ec..c9c6db5f77c2ff796a0b4be831f558b1c8a09d22 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1831,6 +1831,8 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma, r = fixup_user_fault(current, current->mm, addr, (write_fault ? FAULT_FLAG_WRITE : 0), &unlocked); + if (unlocked) + return -EAGAIN; if (r) return r; @@ -1901,12 +1903,15 @@ static kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async, goto exit; } +retry: vma = find_vma_intersection(current->mm, addr, addr + 1); if (vma == NULL) pfn = KVM_PFN_ERR_FAULT; else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) { r = hva_to_pfn_remapped(vma, addr, async, write_fault, writable, &pfn); + if (r == -EAGAIN) + goto retry; if (r < 0) pfn = KVM_PFN_ERR_FAULT; } else {