Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24927
b: refs/heads/master
c: e4e5d3f
h: refs/heads/master
i:
  24925: ce09e10
  24923: 392a0aa
  24919: 335c527
  24911: a65db1d
  24895: aed9b2c
v: v3
  • Loading branch information
Herbert Poetzl authored and Linus Torvalds committed Mar 31, 2006
1 parent a540d77 commit cb18bfd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 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: 158d9ebd19280582da172626ad3edda1a626dace
refs/heads/master: e4e5d3fc80d26ed26ebe42907b224f08d7eccfbf
13 changes: 8 additions & 5 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,15 @@ static int proc_oom_score(struct task_struct *task, char *buffer)

/* If the process being read is separated by chroot from the reading process,
* don't let the reader access the threads.
*
* note: this does dput(root) and mntput(vfsmnt) on exit.
*/
static int proc_check_chroot(struct dentry *root, struct vfsmount *vfsmnt)
{
struct dentry *de, *base;
struct vfsmount *our_vfsmnt, *mnt;
int res = 0;

read_lock(&current->fs->lock);
our_vfsmnt = mntget(current->fs->rootmnt);
base = dget(current->fs->root);
Expand All @@ -549,11 +552,11 @@ static int proc_check_chroot(struct dentry *root, struct vfsmount *vfsmnt)
de = root;
mnt = vfsmnt;

while (vfsmnt != our_vfsmnt) {
if (vfsmnt == vfsmnt->mnt_parent)
while (mnt != our_vfsmnt) {
if (mnt == mnt->mnt_parent)
goto out;
de = vfsmnt->mnt_mountpoint;
vfsmnt = vfsmnt->mnt_parent;
de = mnt->mnt_mountpoint;
mnt = mnt->mnt_parent;
}

if (!is_subdir(de, base))
Expand All @@ -564,7 +567,7 @@ static int proc_check_chroot(struct dentry *root, struct vfsmount *vfsmnt)
dput(base);
mntput(our_vfsmnt);
dput(root);
mntput(mnt);
mntput(vfsmnt);
return res;
out:
spin_unlock(&vfsmount_lock);
Expand Down

0 comments on commit cb18bfd

Please sign in to comment.