@@ -2811,16 +2811,13 @@ static int do_munmap_zap_rlock(struct mm_struct *mm, unsigned long start,
}
/*
- * Unmapping vmas, which have:
- * VM_PFNMAP or
- * uprobes
- * need get done with write mmap_sem held since they may update
- * vm_flags. Deal with such mappings with regular do_munmap() call.
+ * Unmapping vmas, which have uprobes need get done with write
+ * mmap_sem held since they may update vm_flags. Deal with such
+ * mappings with regular do_munmap() call.
*/
for (vma = start_vma; vma && vma->vm_start < end; vma = vma->vm_next) {
- if ((vma->vm_file &&
- has_uprobes(vma, vma->vm_start, vma->vm_end)) ||
- (vma->vm_flags & VM_PFNMAP))
+ if (vma->vm_file &&
+ has_uprobes(vma, vma->vm_start, vma->vm_end))
goto regular_path;
}
When unmapping VM_PFNMAP mappings, vm flags need to be updated. Since the vmas have been detached, so it sounds safe to update vm flags with read mmap_sem. Cc: Michal Hocko <mhocko@kernel.org> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com> --- mm/mmap.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)