Skip to content

Commit 3ae94a5

Browse files
dev-aaront-orggregkh
authored andcommitted
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>
1 parent ea34511 commit 3ae94a5

1 file changed

Lines changed: 0 additions & 18 deletions

File tree

fs/debugfs/inode.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,6 @@ static int debugfs_get_tree(struct fs_context *fc)
287287
{
288288
int err;
289289

290-
if (!(debugfs_allow & DEBUGFS_ALLOW_API))
291-
return -EPERM;
292-
293290
err = get_tree_single(fc, debugfs_fill_super);
294291
if (err)
295292
return err;
@@ -434,11 +431,6 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
434431
if (IS_ERR(dentry))
435432
return dentry;
436433

437-
if (!(debugfs_allow & DEBUGFS_ALLOW_API)) {
438-
failed_creating(dentry);
439-
return ERR_PTR(-EPERM);
440-
}
441-
442434
inode = debugfs_get_inode(dentry->d_sb);
443435
if (unlikely(!inode)) {
444436
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)
584576
if (IS_ERR(dentry))
585577
return dentry;
586578

587-
if (!(debugfs_allow & DEBUGFS_ALLOW_API)) {
588-
failed_creating(dentry);
589-
return ERR_PTR(-EPERM);
590-
}
591-
592579
inode = debugfs_get_inode(dentry->d_sb);
593580
if (unlikely(!inode)) {
594581
pr_err("out of free dentries, can not create directory '%s'\n",
@@ -631,11 +618,6 @@ struct dentry *debugfs_create_automount(const char *name,
631618
if (IS_ERR(dentry))
632619
return dentry;
633620

634-
if (!(debugfs_allow & DEBUGFS_ALLOW_API)) {
635-
failed_creating(dentry);
636-
return ERR_PTR(-EPERM);
637-
}
638-
639621
inode = debugfs_get_inode(dentry->d_sb);
640622
if (unlikely(!inode)) {
641623
pr_err("out of free dentries, can not create automount '%s'\n",

0 commit comments

Comments
 (0)