diff options
author | John Johansen <john.johansen@canonical.com> | 2012-02-16 15:32:47 +0100 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2012-03-14 14:15:23 +0100 |
commit | 3372b68a3c982611dcc30b3c872f8bbdee019e5e (patch) | |
tree | 6266a00311e1fce559326447e6b65952ca2db4c9 /security/apparmor/path.c | |
parent | AppArmor: Retrieve the dentry_path for error reporting when path lookup fails (diff) | |
download | linux-3372b68a3c982611dcc30b3c872f8bbdee019e5e.tar.xz linux-3372b68a3c982611dcc30b3c872f8bbdee019e5e.zip |
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/path.c')
-rw-r--r-- | security/apparmor/path.c | 16 |
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, struct path root; get_fs_root(current->fs, &root); res = __d_path(path, &root, buf, buflen); - if (res && !IS_ERR(res)) { - /* everything's fine */ - *name = res; - path_put(&root); - goto ok; - } path_put(&root); - connected = 0; - } else + } else { res = d_absolute_path(path, buf, buflen); + if (!our_mnt(path->mnt)) + connected = 0; + } /* handle error conditions - and still allow a partial path to * be returned. */ - if (IS_ERR(res)) { + if (!res || IS_ERR(res)) { + connected = 0; res = dentry_path_raw(path->dentry, buf, buflen); if (IS_ERR(res)) { error = PTR_ERR(res); @@ -109,7 +106,6 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, *name = res; -ok: /* Handle two cases: * 1. A deleted dentry && profile is not allowing mediation of deleted * 2. On some filesystems, newly allocated dentries appear to the |