summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-01-29 15:02:33 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2015-02-22 19:38:40 +0300
commit2c616d4d88de1dc5b1545eefdc2e291eeb9f2e9d (patch)
tree1a0731e3353c26c9f0b0ddf94232569132d94995 /security
parent8802565b605fc718046684f463845a1147f2fabd (diff)
downloadlinux-2c616d4d88de1dc5b1545eefdc2e291eeb9f2e9d.tar.xz
SELinux: Use d_is_positive() rather than testing dentry->d_inode
Use d_is_positive() rather than testing dentry->d_inode in SELinux to get rid of direct references to d_inode outside of the VFS. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/hooks.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 29c39e0b03ed..79f2c2cb68ad 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1822,12 +1822,12 @@ static inline int may_rename(struct inode *old_dir,
ad.u.dentry = new_dentry;
av = DIR__ADD_NAME | DIR__SEARCH;
- if (new_dentry->d_inode)
+ if (d_is_positive(new_dentry))
av |= DIR__REMOVE_NAME;
rc = avc_has_perm(sid, new_dsec->sid, SECCLASS_DIR, av, &ad);
if (rc)
return rc;
- if (new_dentry->d_inode) {
+ if (d_is_positive(new_dentry)) {
new_isec = new_dentry->d_inode->i_security;
new_is_dir = S_ISDIR(new_dentry->d_inode->i_mode);
rc = avc_has_perm(sid, new_isec->sid,