diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-02-05 01:41:33 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-03 14:07:59 -0500 |
commit | 37afdc7960ab493f827b5df9dc1b71b63b44331c (patch) | |
tree | 6c9b79d2cf73de3c5d371447ded129e3a32167e5 /security/tomoyo | |
parent | 9f5596af44514f99e3a654a4f7cb813354b9e516 (diff) |
get rid of insanity with namespace roots in tomoyo
passing *any* namespace root to __d_path() as root is equivalent
to just passing it {NULL, NULL}; no need to bother with finding
the root of our namespace in there.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security/tomoyo')
-rw-r--r-- | security/tomoyo/realpath.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index 18369d497eb8..6a4f8495f281 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
@@ -89,27 +89,12 @@ int tomoyo_realpath_from_path2(struct path *path, char *newname, | |||
89 | sp = dentry->d_op->d_dname(dentry, newname + offset, | 89 | sp = dentry->d_op->d_dname(dentry, newname + offset, |
90 | newname_len - offset); | 90 | newname_len - offset); |
91 | } else { | 91 | } else { |
92 | /* Taken from d_namespace_path(). */ | 92 | struct path ns_root = {.mnt = NULL, .dentry = NULL}; |
93 | struct path root; | 93 | |
94 | struct path ns_root = { }; | ||
95 | struct path tmp; | ||
96 | |||
97 | read_lock(¤t->fs->lock); | ||
98 | root = current->fs->root; | ||
99 | path_get(&root); | ||
100 | read_unlock(¤t->fs->lock); | ||
101 | spin_lock(&vfsmount_lock); | ||
102 | if (root.mnt && root.mnt->mnt_ns) | ||
103 | ns_root.mnt = mntget(root.mnt->mnt_ns->root); | ||
104 | if (ns_root.mnt) | ||
105 | ns_root.dentry = dget(ns_root.mnt->mnt_root); | ||
106 | spin_unlock(&vfsmount_lock); | ||
107 | spin_lock(&dcache_lock); | 94 | spin_lock(&dcache_lock); |
108 | tmp = ns_root; | 95 | /* go to whatever namespace root we are under */ |
109 | sp = __d_path(path, &tmp, newname, newname_len); | 96 | sp = __d_path(path, &ns_root, newname, newname_len); |
110 | spin_unlock(&dcache_lock); | 97 | spin_unlock(&dcache_lock); |
111 | path_put(&root); | ||
112 | path_put(&ns_root); | ||
113 | /* Prepend "/proc" prefix if using internal proc vfs mount. */ | 98 | /* Prepend "/proc" prefix if using internal proc vfs mount. */ |
114 | if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) && | 99 | if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) && |
115 | (strcmp(path->mnt->mnt_sb->s_type->name, "proc") == 0)) { | 100 | (strcmp(path->mnt->mnt_sb->s_type->name, "proc") == 0)) { |