Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
securityfs: ->d_parent is never NULL or negative
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed May 29, 2016
1 parent 07a8e62 commit 4093d30
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions security/inode.c
Expand Up @@ -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);
Expand Down

0 comments on commit 4093d30

Please sign in to comment.