securityfs: ->d_parent is never NULL or negative
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 29 May 2016 18:54:04 +0000 (14:54 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 29 May 2016 20:22:06 +0000 (16:22 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
security/inode.c

index 526f82269cb09ca2fdae3860602187aa53f15039..e3df905ab5b163fc4d423c8c7dff6d9609c63ba7 100644 (file)
@@ -186,20 +186,21 @@ EXPORT_SYMBOL_GPL(securityfs_create_dir);
  */
 void securityfs_remove(struct dentry *dentry)
 {
-       struct dentry *parent;
+       struct inode *dir;
 
        if (!dentry || IS_ERR(dentry))
                return;
 
-       inode_lock(d_inode(parent));
+       dir = d_inode(dentry->d_parent);
+       inode_lock(dir);
        if (simple_positive(dentry)) {
                if (d_is_dir(dentry))
-                       simple_rmdir(d_inode(parent), dentry);
+                       simple_rmdir(dir, dentry);
                else
-                       simple_unlink(d_inode(parent), dentry);
+                       simple_unlink(dir, dentry);
                dput(dentry);
        }
-       inode_unlock(d_inode(parent));
+       inode_unlock(dir);
        simple_release_fs(&mount, &mount_count);
 }
 EXPORT_SYMBOL_GPL(securityfs_remove);