summaryrefslogtreecommitdiff
path: root/security/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-05-29 21:54:04 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-29 23:22:06 +0300
commit4093d306a91f240f613f8b2c7c6843f4414adf8c (patch)
tree976d73c91b68edf5e5adb88be0901f6039d33294 /security/inode.c
parent07a8e62fde3c17e3d25e397cb5028176756fa316 (diff)
downloadlinux-4093d306a91f240f613f8b2c7c6843f4414adf8c.tar.xz
securityfs: ->d_parent is never NULL or negative
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security/inode.c')
-rw-r--r--security/inode.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/security/inode.c b/security/inode.c
index 526f82269cb0..e3df905ab5b1 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -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);