Skip to content

Commit

Permalink
close race in /proc/*/environ
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Al Viro committed Mar 23, 2011
1 parent ec6fd8a commit d6f64b8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d6f64b8

Please sign in to comment.