Skip to content

Commit 2c616d4

Browse files
dhowellsAl Viro
authored andcommitted
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>
1 parent 8802565 commit 2c616d4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎security/selinux/hooks.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,12 +1822,12 @@ static inline int may_rename(struct inode *old_dir,
18221822

18231823
ad.u.dentry = new_dentry;
18241824
av = DIR__ADD_NAME | DIR__SEARCH;
1825-
if (new_dentry->d_inode)
1825+
if (d_is_positive(new_dentry))
18261826
av |= DIR__REMOVE_NAME;
18271827
rc = avc_has_perm(sid, new_dsec->sid, SECCLASS_DIR, av, &ad);
18281828
if (rc)
18291829
return rc;
1830-
if (new_dentry->d_inode) {
1830+
if (d_is_positive(new_dentry)) {
18311831
new_isec = new_dentry->d_inode->i_security;
18321832
new_is_dir = S_ISDIR(new_dentry->d_inode->i_mode);
18331833
rc = avc_has_perm(sid, new_isec->sid,

0 commit comments

Comments
 (0)