diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2024-05-14 07:01:27 -0600 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2025-11-17 23:59:27 -0500 |
| commit | 2026c6f8eb23df3b77b81d4d9a19d25126c2f1cf (patch) | |
| tree | 8942010e52acbec14a4cc8e7468fae19a00668bc | |
| parent | fc45aee66223253ec5547094d7552819914abdfb (diff) | |
convert securityfs
securityfs uses simple_recursive_removal(), but does not bother to mark
dentries persistent. This is the only place where it still happens; get
rid of that irregularity.
* use simple_{start,done}_creating() and d_make_persitent(); kill_litter_super()
use was already gone, since we empty the filesystem instance before it gets
shut down.
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | security/inode.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/security/inode.c b/security/inode.c index bf7b5e2e6955..73df5db7f831 100644 --- a/security/inode.c +++ b/security/inode.c @@ -127,24 +127,19 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode, parent = mount->mnt_root; } - dir = d_inode(parent); - - inode_lock(dir); - dentry = lookup_noperm(&QSTR(name), parent); - if (IS_ERR(dentry)) + inode = new_inode(parent->d_sb); + if (unlikely(!inode)) { + dentry = ERR_PTR(-ENOMEM); goto out; - - if (d_really_is_positive(dentry)) { - error = -EEXIST; - goto out1; } - inode = new_inode(dir->i_sb); - if (!inode) { - error = -ENOMEM; - goto out1; - } + dir = d_inode(parent); + dentry = simple_start_creating(parent, name); + if (IS_ERR(dentry)) { + iput(inode); + goto out; + } inode->i_ino = get_next_ino(); inode->i_mode = mode; simple_inode_init_ts(inode); @@ -160,15 +155,11 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode, } else { inode->i_fop = fops; } - d_instantiate(dentry, inode); - inode_unlock(dir); - return dentry; + d_make_persistent(dentry, inode); + simple_done_creating(dentry); + return dentry; // borrowed -out1: - dput(dentry); - dentry = ERR_PTR(error); out: - inode_unlock(dir); if (pinned) simple_release_fs(&mount, &mount_count); return dentry; |