[apparmor] [PATCH 11/20] AppArmor: Minor cleanup of d_namespace_path to consolidate error handling
John Johansen
john.johansen at canonical.com
Wed Feb 22 17:22:54 UTC 2012
Signed-off-by: John Johansen <john.johansen at canonical.com>
---
security/apparmor/path.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/security/apparmor/path.c b/security/apparmor/path.c
index 96fb310..2bda438 100644
--- a/security/apparmor/path.c
+++ b/security/apparmor/path.c
@@ -84,33 +84,28 @@ 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);
*name = buf;
goto out;
};
- } else if (!our_mnt(path->mnt))
- connected = 0;
+ }
*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
--
1.7.9
More information about the AppArmor
mailing list