vm_flags_t vm_flags;
};
-static int kvm_s2_fault_pin_pfn(struct kvm_s2_fault *fault)
+static int kvm_s2_fault_get_vma_info(struct kvm_s2_fault *fault)
{
struct vm_area_struct *vma;
struct kvm *kvm = fault->vcpu->kvm;
fault->is_vma_cacheable = kvm_vma_is_cacheable(vma);
- /* Don't use the VMA after the unlock -- it may have vanished */
- vma = NULL;
-
/*
* Read mmu_invalidate_seq so that KVM can detect if the results of
* vma_lookup() or __kvm_faultin_pfn() become stale prior to
fault->mmu_seq = kvm->mmu_invalidate_seq;
mmap_read_unlock(current->mm);
+ return 0;
+}
+
+static int kvm_s2_fault_pin_pfn(struct kvm_s2_fault *fault)
+{
+ int ret;
+
+ ret = kvm_s2_fault_get_vma_info(fault);
+ if (ret)
+ return ret;
+
fault->pfn = __kvm_faultin_pfn(fault->memslot, fault->gfn,
fault->write_fault ? FOLL_WRITE : 0,
&fault->writable, &fault->page);