Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Aaron Thompson and committed by
Greg Kroah-Hartman
3ae94a55 ea34511a

-18
-18
fs/debugfs/inode.c
··· 287 287 { 288 288 int err; 289 289 290 - if (!(debugfs_allow & DEBUGFS_ALLOW_API)) 291 - return -EPERM; 292 - 293 290 err = get_tree_single(fc, debugfs_fill_super); 294 291 if (err) 295 292 return err; ··· 430 433 431 434 if (IS_ERR(dentry)) 432 435 return dentry; 433 - 434 - if (!(debugfs_allow & DEBUGFS_ALLOW_API)) { 435 - failed_creating(dentry); 436 - return ERR_PTR(-EPERM); 437 - } 438 436 439 437 inode = debugfs_get_inode(dentry->d_sb); 440 438 if (unlikely(!inode)) { ··· 576 584 if (IS_ERR(dentry)) 577 585 return dentry; 578 586 579 - if (!(debugfs_allow & DEBUGFS_ALLOW_API)) { 580 - failed_creating(dentry); 581 - return ERR_PTR(-EPERM); 582 - } 583 - 584 587 inode = debugfs_get_inode(dentry->d_sb); 585 588 if (unlikely(!inode)) { 586 589 pr_err("out of free dentries, can not create directory '%s'\n", ··· 617 630 618 631 if (IS_ERR(dentry)) 619 632 return dentry; 620 - 621 - if (!(debugfs_allow & DEBUGFS_ALLOW_API)) { 622 - failed_creating(dentry); 623 - return ERR_PTR(-EPERM); 624 - } 625 633 626 634 inode = debugfs_get_inode(dentry->d_sb); 627 635 if (unlikely(!inode)) {