summaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-02-16 04:26:01 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-23 21:36:51 +0100
commitd6f64b89d7ff22ce05896ab4a93a653e8d0b123d (patch)
tree21bc9a103dade9b22ced58455dde7cd00e01cd28 /fs/proc/base.c
parentreport errors in /proc/*/*map* sanely (diff)
downloadlinux-d6f64b89d7ff22ce05896ab4a93a653e8d0b123d.tar.xz
linux-d6f64b89d7ff22ce05896ab4a93a653e8d0b123d.zip
close race in /proc/*/environ
Switch to mm_for_maps(). Maybe we ought to make it r--r--r--, since we do checks on IO anyway... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index c28281102082..fc471b8766d1 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -919,20 +919,18 @@ static ssize_t environ_read(struct file *file, char __user *buf,
if (!task)
goto out_no_task;
- if (!ptrace_may_access(task, PTRACE_MODE_READ))
- goto out;
-
ret = -ENOMEM;
page = (char *)__get_free_page(GFP_TEMPORARY);
if (!page)
goto out;
- ret = 0;
- mm = get_task_mm(task);
- if (!mm)
+ mm = mm_for_maps(task);
+ ret = PTR_ERR(mm);
+ if (!mm || IS_ERR(mm))
goto out_free;
+ ret = 0;
while (count > 0) {
int this_len, retval, max_len;