Skip to content

Commit

Permalink
AppArmor: Retrieve the dentry_path for error reporting when path look…
Browse files Browse the repository at this point in the history
…up fails

When __d_path and d_absolute_path fail due to the name being outside of
the current namespace no name is reported.  Use dentry_path to provide
some hint as to which file was being accessed.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Kees Cook <kees@ubuntu.com>
  • Loading branch information
John Johansen committed Mar 14, 2012
1 parent 33e521a commit fbba8d8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions security/apparmor/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,21 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
} else
res = d_absolute_path(path, buf, buflen);

*name = res;
/* handle error conditions - and still allow a partial path to
* be returned.
*/
if (IS_ERR(res)) {
error = PTR_ERR(res);
*name = buf;
goto out;
}
if (!our_mnt(path->mnt))
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
Expand Down

0 comments on commit fbba8d8

Please sign in to comment.