Skip to content

Commit

Permalink
proc: use mm_access() instead of ptrace_may_access()
Browse files Browse the repository at this point in the history
mm_access() handles this much better, and avoids some race conditions.

Signed-off-by: Cong 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Cong Wang authored and Linus Torvalds committed Jun 1, 2012
1 parent e7dcd99 commit 2344bec
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2022,11 +2022,8 @@ static int map_files_d_revalidate(struct dentry *dentry, struct nameidata *nd)
if (!task)
goto out_notask;

if (!ptrace_may_access(task, PTRACE_MODE_READ))
goto out;

mm = get_task_mm(task);
if (!mm)
mm = mm_access(task, PTRACE_MODE_READ);
if (IS_ERR_OR_NULL(mm))
goto out;

if (!dname_to_vma_addr(dentry, &vm_start, &vm_end)) {
Expand Down

0 comments on commit 2344bec

Please sign in to comment.