Commit 4093d306 authored by Al Viro's avatar Al Viro

securityfs: ->d_parent is never NULL or negative

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 07a8e62f
...@@ -186,20 +186,21 @@ EXPORT_SYMBOL_GPL(securityfs_create_dir); ...@@ -186,20 +186,21 @@ EXPORT_SYMBOL_GPL(securityfs_create_dir);
*/ */
void securityfs_remove(struct dentry *dentry) void securityfs_remove(struct dentry *dentry)
{ {
struct dentry *parent; struct inode *dir;
if (!dentry || IS_ERR(dentry)) if (!dentry || IS_ERR(dentry))
return; return;
inode_lock(d_inode(parent)); dir = d_inode(dentry->d_parent);
inode_lock(dir);
if (simple_positive(dentry)) { if (simple_positive(dentry)) {
if (d_is_dir(dentry)) if (d_is_dir(dentry))
simple_rmdir(d_inode(parent), dentry); simple_rmdir(dir, dentry);
else else
simple_unlink(d_inode(parent), dentry); simple_unlink(dir, dentry);
dput(dentry); dput(dentry);
} }
inode_unlock(d_inode(parent)); inode_unlock(dir);
simple_release_fs(&mount, &mount_count); simple_release_fs(&mount, &mount_count);
} }
EXPORT_SYMBOL_GPL(securityfs_remove); EXPORT_SYMBOL_GPL(securityfs_remove);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment