Commit 2344bec7 authored by Cong Wang's avatar Cong Wang Committed by Linus Torvalds

proc: use mm_access() instead of ptrace_may_access()

mm_access() handles this much better, and avoids some race conditions.
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e7dcd999
...@@ -2022,11 +2022,8 @@ static int map_files_d_revalidate(struct dentry *dentry, struct nameidata *nd) ...@@ -2022,11 +2022,8 @@ static int map_files_d_revalidate(struct dentry *dentry, struct nameidata *nd)
if (!task) if (!task)
goto out_notask; goto out_notask;
if (!ptrace_may_access(task, PTRACE_MODE_READ)) mm = mm_access(task, PTRACE_MODE_READ);
goto out; if (IS_ERR_OR_NULL(mm))
mm = get_task_mm(task);
if (!mm)
goto out; goto out;
if (!dname_to_vma_addr(dentry, &vm_start, &vm_end)) { if (!dname_to_vma_addr(dentry, &vm_start, &vm_end)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment