Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode
authorDavid Howells <dhowells@redhat.com>
Thu, 29 Jan 2015 12:02:31 +0000 (12:02 +0000)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 22 Feb 2015 16:38:39 +0000 (11:38 -0500)
Use d_is_positive(dentry) or d_is_negative(dentry) rather than testing
dentry->d_inode as the dentry may cover another layer that has an inode when
the top layer doesn't or may hold a 0,0 chardev that's actually a whiteout.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
security/apparmor/path.c

index 35b394a75d762dd6a4e935f3ffe1d5b4566a2885..71e0e3a15b9dc3bbae6b73cd1d8134768f67d2c5 100644 (file)
@@ -114,7 +114,7 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
         *    security_path hooks as a deleted dentry except without an inode
         *    allocated.
         */
-       if (d_unlinked(path->dentry) && path->dentry->d_inode &&
+       if (d_unlinked(path->dentry) && d_is_positive(path->dentry) &&
            !(flags & PATH_MEDIATE_DELETED)) {
                        error = -ENOENT;
                        goto out;