diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-02-15 22:26:01 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-23 16:36:51 -0400 |
commit | d6f64b89d7ff22ce05896ab4a93a653e8d0b123d (patch) | |
tree | 21bc9a103dade9b22ced58455dde7cd00e01cd28 /fs/proc/base.c | |
parent | ec6fd8a4355cda81cd9f06bebc048e83eb514ac7 (diff) |
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.c | 10 |
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, | |||
919 | if (!task) | 919 | if (!task) |
920 | goto out_no_task; | 920 | goto out_no_task; |
921 | 921 | ||
922 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) | ||
923 | goto out; | ||
924 | |||
925 | ret = -ENOMEM; | 922 | ret = -ENOMEM; |
926 | page = (char *)__get_free_page(GFP_TEMPORARY); | 923 | page = (char *)__get_free_page(GFP_TEMPORARY); |
927 | if (!page) | 924 | if (!page) |
928 | goto out; | 925 | goto out; |
929 | 926 | ||
930 | ret = 0; | ||
931 | 927 | ||
932 | mm = get_task_mm(task); | 928 | mm = mm_for_maps(task); |
933 | if (!mm) | 929 | ret = PTR_ERR(mm); |
930 | if (!mm || IS_ERR(mm)) | ||
934 | goto out_free; | 931 | goto out_free; |
935 | 932 | ||
933 | ret = 0; | ||
936 | while (count > 0) { | 934 | while (count > 0) { |
937 | int this_len, retval, max_len; | 935 | int this_len, retval, max_len; |
938 | 936 | ||