Only attempt async pagefault if address is contained within vma.
Signed-off-by: Marcelo Tosatti <[email protected]>
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 5d57ec9..a9cfbd2 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -996,8 +996,9 @@ static pfn_t hva_to_pfn(struct kvm *kvm, unsigned long
addr, bool atomic,
if (vma == NULL || addr < vma->vm_start ||
!(vma->vm_flags & VM_PFNMAP)) {
- if (async && !(vma->vm_flags & VM_PFNMAP) &&
- (vma->vm_flags & VM_WRITE))
+ if (async && vma && !(vma->vm_flags & VM_PFNMAP) &&
+ (vma->vm_flags & VM_WRITE) &&
+ addr >= vma->vm_start)
*async = true;
up_read(¤t->mm->mmap_sem);
return_fault_page:
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html