aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2010-03-30 17:39:27 -0400
committerJames Morris <jmorris@namei.org>2010-03-30 17:39:27 -0400
commitd25d6fa1a95f465ff1ec4458ca15e30b2c8dffec (patch)
tree7362b182dedd825fc762ef7706830837e42943af /security/tomoyo
parent225a9be24d799aa16d543c31fb09f0c9ed1d9caa (diff)
parent2eaa9cfdf33b8d7fb7aff27792192e0019ae8fc6 (diff)
Merge branch 'master' into next
Diffstat (limited to 'security/tomoyo')
-rw-r--r--security/tomoyo/common.c1
-rw-r--r--security/tomoyo/realpath.c23
2 files changed, 5 insertions, 19 deletions
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 8ccf12997378..588f36a9337e 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -886,6 +886,7 @@ static struct tomoyo_profile *tomoyo_find_or_assign_new_profile(const unsigned
886 ptr = kmalloc(sizeof(*ptr), GFP_KERNEL); 886 ptr = kmalloc(sizeof(*ptr), GFP_KERNEL);
887 if (!tomoyo_memory_ok(ptr)) { 887 if (!tomoyo_memory_ok(ptr)) {
888 kfree(ptr); 888 kfree(ptr);
889 ptr = NULL;
889 goto ok; 890 goto ok;
890 } 891 }
891 for (i = 0; i < TOMOYO_MAX_CONTROL_INDEX; i++) 892 for (i = 0; i < TOMOYO_MAX_CONTROL_INDEX; i++)
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
index c00df45c7ede..cf7d61f781b9 100644
--- a/security/tomoyo/realpath.c
+++ b/security/tomoyo/realpath.c
@@ -88,29 +88,14 @@ int tomoyo_realpath_from_path2(struct path *path, char *newname,
88 sp = dentry->d_op->d_dname(dentry, newname + offset, 88 sp = dentry->d_op->d_dname(dentry, newname + offset,
89 newname_len - offset); 89 newname_len - offset);
90 } else { 90 } else {
91 /* Taken from d_namespace_path(). */ 91 struct path ns_root = {.mnt = NULL, .dentry = NULL};
92 struct path root;
93 struct path ns_root = { };
94 struct path tmp;
95 92
96 read_lock(&current->fs->lock);
97 root = current->fs->root;
98 path_get(&root);
99 read_unlock(&current->fs->lock);
100 spin_lock(&vfsmount_lock);
101 if (root.mnt && root.mnt->mnt_ns)
102 ns_root.mnt = mntget(root.mnt->mnt_ns->root);
103 if (ns_root.mnt)
104 ns_root.dentry = dget(ns_root.mnt->mnt_root);
105 spin_unlock(&vfsmount_lock);
106 spin_lock(&dcache_lock); 93 spin_lock(&dcache_lock);
107 tmp = ns_root; 94 /* go to whatever namespace root we are under */
108 sp = __d_path(path, &tmp, newname, newname_len); 95 sp = __d_path(path, &ns_root, newname, newname_len);
109 spin_unlock(&dcache_lock); 96 spin_unlock(&dcache_lock);
110 path_put(&root);
111 path_put(&ns_root);
112 /* Prepend "/proc" prefix if using internal proc vfs mount. */ 97 /* Prepend "/proc" prefix if using internal proc vfs mount. */
113 if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) && 98 if (!IS_ERR(sp) && (path->mnt->mnt_flags & MNT_INTERNAL) &&
114 (path->mnt->mnt_sb->s_magic == PROC_SUPER_MAGIC)) { 99 (path->mnt->mnt_sb->s_magic == PROC_SUPER_MAGIC)) {
115 sp -= 5; 100 sp -= 5;
116 if (sp >= newname) 101 if (sp >= newname)