History

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.

David Howells committed 11 years ago

Commit 2c616d41 parent 88025651 file · +2 −2Browse files

Unified · Split

security/selinux/hooks.c+2−2
@@ -1822,12 +1822,12 @@ static inline int may_rename(struct inode *old_dir, · 1821 unmodified lines
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,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t