aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-01-29 07:02:32 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-02-22 11:38:39 -0500
commite656a8eb2e0b35258219bb46929323e4d1f49dad (patch)
treef24433342114d749148d5e51fb8ac2f757c9e226
parent729b8a3dee2bc873e4647e9384de9111548e599e (diff)
TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()
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>
-rw-r--r--security/tomoyo/file.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c
index 400390790745..c151a1869597 100644
--- a/security/tomoyo/file.c
+++ b/security/tomoyo/file.c
@@ -905,11 +905,9 @@ int tomoyo_path2_perm(const u8 operation, struct path *path1,
905 !tomoyo_get_realpath(&buf2, path2)) 905 !tomoyo_get_realpath(&buf2, path2))
906 goto out; 906 goto out;
907 switch (operation) { 907 switch (operation) {
908 struct dentry *dentry;
909 case TOMOYO_TYPE_RENAME: 908 case TOMOYO_TYPE_RENAME:
910 case TOMOYO_TYPE_LINK: 909 case TOMOYO_TYPE_LINK:
911 dentry = path1->dentry; 910 if (!d_is_dir(path1->dentry))
912 if (!dentry->d_inode || !S_ISDIR(dentry->d_inode->i_mode))
913 break; 911 break;
914 /* fall through */ 912 /* fall through */
915 case TOMOYO_TYPE_PIVOT_ROOT: 913 case TOMOYO_TYPE_PIVOT_ROOT: