diff options
author | David Howells <dhowells@redhat.com> | 2015-01-29 07:02:33 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-02-22 11:38:40 -0500 |
commit | 2c616d4d88de1dc5b1545eefdc2e291eeb9f2e9d (patch) | |
tree | 1a0731e3353c26c9f0b0ddf94232569132d94995 /security | |
parent | 8802565b605fc718046684f463845a1147f2fabd (diff) |
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.c | 4 |
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, | |||
1822 | 1822 | ||
1823 | ad.u.dentry = new_dentry; | 1823 | ad.u.dentry = new_dentry; |
1824 | av = DIR__ADD_NAME | DIR__SEARCH; | 1824 | av = DIR__ADD_NAME | DIR__SEARCH; |
1825 | if (new_dentry->d_inode) | 1825 | if (d_is_positive(new_dentry)) |
1826 | av |= DIR__REMOVE_NAME; | 1826 | av |= DIR__REMOVE_NAME; |
1827 | rc = avc_has_perm(sid, new_dsec->sid, SECCLASS_DIR, av, &ad); | 1827 | rc = avc_has_perm(sid, new_dsec->sid, SECCLASS_DIR, av, &ad); |
1828 | if (rc) | 1828 | if (rc) |
1829 | return rc; | 1829 | return rc; |
1830 | if (new_dentry->d_inode) { | 1830 | if (d_is_positive(new_dentry)) { |
1831 | new_isec = new_dentry->d_inode->i_security; | 1831 | new_isec = new_dentry->d_inode->i_security; |
1832 | new_is_dir = S_ISDIR(new_dentry->d_inode->i_mode); | 1832 | new_is_dir = S_ISDIR(new_dentry->d_inode->i_mode); |
1833 | rc = avc_has_perm(sid, new_isec->sid, | 1833 | rc = avc_has_perm(sid, new_isec->sid, |