diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-29 14:54:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-29 16:22:06 -0400 |
commit | 4093d306a91f240f613f8b2c7c6843f4414adf8c (patch) | |
tree | 976d73c91b68edf5e5adb88be0901f6039d33294 | |
parent | 07a8e62fde3c17e3d25e397cb5028176756fa316 (diff) |
securityfs: ->d_parent is never NULL or negative
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | security/inode.c | 11 |
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); | |||
186 | */ | 186 | */ |
187 | void securityfs_remove(struct dentry *dentry) | 187 | void securityfs_remove(struct dentry *dentry) |
188 | { | 188 | { |
189 | struct dentry *parent; | 189 | struct inode *dir; |
190 | 190 | ||
191 | if (!dentry || IS_ERR(dentry)) | 191 | if (!dentry || IS_ERR(dentry)) |
192 | return; | 192 | return; |
193 | 193 | ||
194 | inode_lock(d_inode(parent)); | 194 | dir = d_inode(dentry->d_parent); |
195 | inode_lock(dir); | ||
195 | if (simple_positive(dentry)) { | 196 | if (simple_positive(dentry)) { |
196 | if (d_is_dir(dentry)) | 197 | if (d_is_dir(dentry)) |
197 | simple_rmdir(d_inode(parent), dentry); | 198 | simple_rmdir(dir, dentry); |
198 | else | 199 | else |
199 | simple_unlink(d_inode(parent), dentry); | 200 | simple_unlink(dir, dentry); |
200 | dput(dentry); | 201 | dput(dentry); |
201 | } | 202 | } |
202 | inode_unlock(d_inode(parent)); | 203 | inode_unlock(dir); |
203 | simple_release_fs(&mount, &mount_count); | 204 | simple_release_fs(&mount, &mount_count); |
204 | } | 205 | } |
205 | EXPORT_SYMBOL_GPL(securityfs_remove); | 206 | EXPORT_SYMBOL_GPL(securityfs_remove); |