debugfs: Remove redundant access mode checks
debugfs_get_tree() can only be called if debugfs itself calls simple_pin_fs() or register_filesystem(), and those call paths also check the access mode. debugfs_start_creating() checks the access mode so the checks in the debugfs_create_* functions are unnecessary. An upcoming change will affect debugfs_allow, so doing this cleanup first will make that change simpler. Signed-off-by: Aaron Thompson <dev@aaront.org> Link: https://patch.msgid.link/20251120102222.18371-2-dev@null.aaront.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ea34511aaf
commit
3ae94a55d0
@@ -287,9 +287,6 @@ static int debugfs_get_tree(struct fs_context *fc)
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!(debugfs_allow & DEBUGFS_ALLOW_API))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
err = get_tree_single(fc, debugfs_fill_super);
|
err = get_tree_single(fc, debugfs_fill_super);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
@@ -434,11 +431,6 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
|
|||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
return dentry;
|
return dentry;
|
||||||
|
|
||||||
if (!(debugfs_allow & DEBUGFS_ALLOW_API)) {
|
|
||||||
failed_creating(dentry);
|
|
||||||
return ERR_PTR(-EPERM);
|
|
||||||
}
|
|
||||||
|
|
||||||
inode = debugfs_get_inode(dentry->d_sb);
|
inode = debugfs_get_inode(dentry->d_sb);
|
||||||
if (unlikely(!inode)) {
|
if (unlikely(!inode)) {
|
||||||
pr_err("out of free dentries, can not create file '%s'\n",
|
pr_err("out of free dentries, can not create file '%s'\n",
|
||||||
@@ -584,11 +576,6 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
|
|||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
return dentry;
|
return dentry;
|
||||||
|
|
||||||
if (!(debugfs_allow & DEBUGFS_ALLOW_API)) {
|
|
||||||
failed_creating(dentry);
|
|
||||||
return ERR_PTR(-EPERM);
|
|
||||||
}
|
|
||||||
|
|
||||||
inode = debugfs_get_inode(dentry->d_sb);
|
inode = debugfs_get_inode(dentry->d_sb);
|
||||||
if (unlikely(!inode)) {
|
if (unlikely(!inode)) {
|
||||||
pr_err("out of free dentries, can not create directory '%s'\n",
|
pr_err("out of free dentries, can not create directory '%s'\n",
|
||||||
@@ -631,11 +618,6 @@ struct dentry *debugfs_create_automount(const char *name,
|
|||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
return dentry;
|
return dentry;
|
||||||
|
|
||||||
if (!(debugfs_allow & DEBUGFS_ALLOW_API)) {
|
|
||||||
failed_creating(dentry);
|
|
||||||
return ERR_PTR(-EPERM);
|
|
||||||
}
|
|
||||||
|
|
||||||
inode = debugfs_get_inode(dentry->d_sb);
|
inode = debugfs_get_inode(dentry->d_sb);
|
||||||
if (unlikely(!inode)) {
|
if (unlikely(!inode)) {
|
||||||
pr_err("out of free dentries, can not create automount '%s'\n",
|
pr_err("out of free dentries, can not create automount '%s'\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user