Commit 8802565b605fc718046684f463845a1147f2fabd

Authored by David Howells
Committed by Al Viro
1 parent e656a8eb2e

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>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

security/smack/smack_lsm.c
... ... @@ -855,7 +855,7 @@
855 855 rc = smk_curacc(isp, MAY_WRITE, &ad);
856 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 859 isp = smk_of_inode(new_dentry->d_inode);
860 860 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry);
861 861 rc = smk_curacc(isp, MAY_WRITE, &ad);
... ... @@ -961,7 +961,7 @@
961 961 rc = smk_curacc(isp, MAY_READWRITE, &ad);
962 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 965 isp = smk_of_inode(new_dentry->d_inode);
966 966 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry);
967 967 rc = smk_curacc(isp, MAY_READWRITE, &ad);