]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
proc: use mm_access() instead of ptrace_may_access()
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 3 May 2012 05:44:40 +0000 (15:44 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 3 May 2012 05:46:55 +0000 (15:46 +1000)
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>
fs/proc/base.c

index 69bcc87fb19b1fb41a3b266b70eb85e7453f20f6..a05bc466f5b03216b7dd771c2ccad31e3031ccee 100644 (file)
@@ -2035,11 +2035,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)) {