Change handle_userfault to drop the proper memory range as indicated in the vmf. Signed-off-by: Michel Lespinasse <walken@xxxxxxxxxx> --- fs/userfaultfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git fs/userfaultfd.c fs/userfaultfd.c index f38095a7ebcd..2b8ee3eaacd7 100644 --- fs/userfaultfd.c +++ fs/userfaultfd.c @@ -489,7 +489,7 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) must_wait = userfaultfd_huge_must_wait(ctx, vmf->vma, vmf->address, vmf->flags, reason); - mm_read_unlock(mm); + mm_read_range_unlock(mm, vmf->range); if (likely(must_wait && !READ_ONCE(ctx->released) && (return_to_userland ? !signal_pending(current) : @@ -543,7 +543,7 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) * and there's no need to retake the mmap_sem * in such case. */ - mm_read_lock(mm); + mm_read_range_lock(mm, vmf->range); ret = VM_FAULT_NOPAGE; } } -- 2.25.0.341.g760bfbb309-goog