aboutsummaryrefslogtreecommitdiffstats
path: root/security/apparmor
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2012-02-16 09:32:47 -0500
committerJohn Johansen <john.johansen@canonical.com>2012-03-14 09:15:23 -0400
commit3372b68a3c982611dcc30b3c872f8bbdee019e5e (patch)
tree6266a00311e1fce559326447e6b65952ca2db4c9 /security/apparmor
parentfbba8d89acea5d628d1d076b1d8962db438ff832 (diff)
AppArmor: Minor cleanup of d_namespace_path to consolidate error handling
Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Kees Cook <kees@ubuntu.com>
Diffstat (limited to 'security/apparmor')
-rw-r--r--security/apparmor/path.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/security/apparmor/path.c b/security/apparmor/path.c
index 8c90fd0f49c5..a7936dfe0e6c 100644
--- a/security/apparmor/path.c
+++ b/security/apparmor/path.c
@@ -83,21 +83,18 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
83 struct path root; 83 struct path root;
84 get_fs_root(current->fs, &root); 84 get_fs_root(current->fs, &root);
85 res = __d_path(path, &root, buf, buflen); 85 res = __d_path(path, &root, buf, buflen);
86 if (res && !IS_ERR(res)) {
87 /* everything's fine */
88 *name = res;
89 path_put(&root);
90 goto ok;
91 }
92 path_put(&root); 86 path_put(&root);
93 connected = 0; 87 } else {
94 } else
95 res = d_absolute_path(path, buf, buflen); 88 res = d_absolute_path(path, buf, buflen);
89 if (!our_mnt(path->mnt))
90 connected = 0;
91 }
96 92
97 /* handle error conditions - and still allow a partial path to 93 /* handle error conditions - and still allow a partial path to
98 * be returned. 94 * be returned.
99 */ 95 */
100 if (IS_ERR(res)) { 96 if (!res || IS_ERR(res)) {
97 connected = 0;
101 res = dentry_path_raw(path->dentry, buf, buflen); 98 res = dentry_path_raw(path->dentry, buf, buflen);
102 if (IS_ERR(res)) { 99 if (IS_ERR(res)) {
103 error = PTR_ERR(res); 100 error = PTR_ERR(res);
@@ -109,7 +106,6 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
109 106
110 *name = res; 107 *name = res;
111 108
112ok:
113 /* Handle two cases: 109 /* Handle two cases:
114 * 1. A deleted dentry && profile is not allowing mediation of deleted 110 * 1. A deleted dentry && profile is not allowing mediation of deleted
115 * 2. On some filesystems, newly allocated dentries appear to the 111 * 2. On some filesystems, newly allocated dentries appear to the