TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()
authorDavid Howells <dhowells@redhat.com>
Thu, 29 Jan 2015 12:02:32 +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_dir() rather than d_inode and S_ISDIR().  Note that this will include
fake directories such as automount triggers.

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

index 400390790745212764bd99c9178dceea031382ef..c151a1869597f8155a0296f89fafa61cc65f447d 100644 (file)
@@ -905,11 +905,9 @@ int tomoyo_path2_perm(const u8 operation, struct path *path1,
            !tomoyo_get_realpath(&buf2, path2))
                goto out;
        switch (operation) {
-               struct dentry *dentry;
        case TOMOYO_TYPE_RENAME:
        case TOMOYO_TYPE_LINK:
-               dentry = path1->dentry;
-               if (!dentry->d_inode || !S_ISDIR(dentry->d_inode->i_mode))
+               if (!d_is_dir(path1->dentry))
                        break;
                /* fall through */
        case TOMOYO_TYPE_PIVOT_ROOT: