diff --git a/mm/memory.c b/mm/memory.c index d8a225dca633..52327d11b3ff 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5267,6 +5267,11 @@ vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address, goto out; } + if ((flags & FAULT_FLAG_VMA_LOCK) && !vma_is_anonymous(vma)) { + vma_end_read(vma); + return VM_FAULT_RETRY; + } + /* * Enable the memcg OOM handling for faults triggered in user * space. Kernel faults are handled more gracefully. @@ -5438,10 +5443,6 @@ retry: if (!vma) goto inval; - /* Only anonymous vmas are supported for now */ - if (!vma_is_anonymous(vma)) - goto inval; - if (!vma_start_read(vma)) goto inval;