aboutsummaryrefslogtreecommitdiffstats
path: root/security
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:40 -0500
commit8802565b605fc718046684f463845a1147f2fabd (patch)
treed6ca43efdf61dd053fae3fe7d6e9e5c846410cb1 /security
parente656a8eb2e0b35258219bb46929323e4d1f49dad (diff)
Smack: Use d_is_positive() rather than testing dentry->d_inode
Use d_is_positive() rather than testing dentry->d_inode in Smack 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/smack/smack_lsm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index ed94f6f836e7..c934311812f1 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -855,7 +855,7 @@ static int smack_inode_link(struct dentry *old_dentry, struct inode *dir,
855 rc = smk_curacc(isp, MAY_WRITE, &ad); 855 rc = smk_curacc(isp, MAY_WRITE, &ad);
856 rc = smk_bu_inode(old_dentry->d_inode, MAY_WRITE, rc); 856 rc = smk_bu_inode(old_dentry->d_inode, MAY_WRITE, rc);
857 857
858 if (rc == 0 && new_dentry->d_inode != NULL) { 858 if (rc == 0 && d_is_positive(new_dentry)) {
859 isp = smk_of_inode(new_dentry->d_inode); 859 isp = smk_of_inode(new_dentry->d_inode);
860 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); 860 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry);
861 rc = smk_curacc(isp, MAY_WRITE, &ad); 861 rc = smk_curacc(isp, MAY_WRITE, &ad);
@@ -961,7 +961,7 @@ static int smack_inode_rename(struct inode *old_inode,
961 rc = smk_curacc(isp, MAY_READWRITE, &ad); 961 rc = smk_curacc(isp, MAY_READWRITE, &ad);
962 rc = smk_bu_inode(old_dentry->d_inode, MAY_READWRITE, rc); 962 rc = smk_bu_inode(old_dentry->d_inode, MAY_READWRITE, rc);
963 963
964 if (rc == 0 && new_dentry->d_inode != NULL) { 964 if (rc == 0 && d_is_positive(new_dentry)) {
965 isp = smk_of_inode(new_dentry->d_inode); 965 isp = smk_of_inode(new_dentry->d_inode);
966 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); 966 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry);
967 rc = smk_curacc(isp, MAY_READWRITE, &ad); 967 rc = smk_curacc(isp, MAY_READWRITE, &ad);