Skip to content

Commit

Permalink
Smack: Use d_is_positive() rather than testing dentry->d_inode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dhowells authored and Al Viro committed Feb 22, 2015
1 parent e656a8e commit 8802565
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/smack/smack_lsm.c
Expand Up @@ -855,7 +855,7 @@ static int smack_inode_link(struct dentry *old_dentry, struct inode *dir,
rc = smk_curacc(isp, MAY_WRITE, &ad);
rc = smk_bu_inode(old_dentry->d_inode, MAY_WRITE, rc);

if (rc == 0 && new_dentry->d_inode != NULL) {
if (rc == 0 && d_is_positive(new_dentry)) {
isp = smk_of_inode(new_dentry->d_inode);
smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry);
rc = smk_curacc(isp, MAY_WRITE, &ad);
Expand Down Expand Up @@ -961,7 +961,7 @@ static int smack_inode_rename(struct inode *old_inode,
rc = smk_curacc(isp, MAY_READWRITE, &ad);
rc = smk_bu_inode(old_dentry->d_inode, MAY_READWRITE, rc);

if (rc == 0 && new_dentry->d_inode != NULL) {
if (rc == 0 && d_is_positive(new_dentry)) {
isp = smk_of_inode(new_dentry->d_inode);
smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry);
rc = smk_curacc(isp, MAY_READWRITE, &ad);
Expand Down

0 comments on commit 8802565

Please sign in to comment.