Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 300331
b: refs/heads/master
c: eb94cd9
h: refs/heads/master
i:
  300329: a5e7040
  300327: 0d02da7
v: v3
  • Loading branch information
Cyrill Gorcunov authored and Linus Torvalds committed May 18, 2012
1 parent 0445fc6 commit 906151a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c0a5f4a05af588a0f9951f8d24e2564b09501918
refs/heads/master: eb94cd96e05d6c65a07937e66a04ea265c1b767d
20 changes: 8 additions & 12 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2177,16 +2177,16 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
goto out;

result = ERR_PTR(-EACCES);
if (lock_trace(task))
if (!ptrace_may_access(task, PTRACE_MODE_READ))
goto out_put_task;

result = ERR_PTR(-ENOENT);
if (dname_to_vma_addr(dentry, &vm_start, &vm_end))
goto out_unlock;
goto out_put_task;

mm = get_task_mm(task);
if (!mm)
goto out_unlock;
goto out_put_task;

down_read(&mm->mmap_sem);
vma = find_exact_vma(mm, vm_start, vm_end);
Expand All @@ -2198,8 +2198,6 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
out_no_vma:
up_read(&mm->mmap_sem);
mmput(mm);
out_unlock:
unlock_trace(task);
out_put_task:
put_task_struct(task);
out:
Expand Down Expand Up @@ -2233,20 +2231,20 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
goto out;

ret = -EACCES;
if (lock_trace(task))
if (!ptrace_may_access(task, PTRACE_MODE_READ))
goto out_put_task;

ret = 0;
switch (filp->f_pos) {
case 0:
ino = inode->i_ino;
if (filldir(dirent, ".", 1, 0, ino, DT_DIR) < 0)
goto out_unlock;
goto out_put_task;
filp->f_pos++;
case 1:
ino = parent_ino(dentry);
if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0)
goto out_unlock;
goto out_put_task;
filp->f_pos++;
default:
{
Expand All @@ -2257,7 +2255,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)

mm = get_task_mm(task);
if (!mm)
goto out_unlock;
goto out_put_task;
down_read(&mm->mmap_sem);

nr_files = 0;
Expand Down Expand Up @@ -2287,7 +2285,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
flex_array_free(fa);
up_read(&mm->mmap_sem);
mmput(mm);
goto out_unlock;
goto out_put_task;
}
for (i = 0, vma = mm->mmap, pos = 2; vma;
vma = vma->vm_next) {
Expand Down Expand Up @@ -2332,8 +2330,6 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
}

out_unlock:
unlock_trace(task);
out_put_task:
put_task_struct(task);
out:
Expand Down

0 comments on commit 906151a

Please sign in to comment.