Skip to content

Commit 358fcf5

Browse files
hramrachgregkh
authored andcommitted
debugfs: lockdown: Allow reading debugfs files that are not world readable
When the kernel is locked down the kernel allows reading only debugfs files with mode 444. Mode 400 is also valid but is not allowed. Make the 444 into a mask. Fixes: 5496197 ("debugfs: Restrict debugfs when the kernel is locked down") Signed-off-by: Michal Suchanek <msuchanek@suse.de> Link: https://lore.kernel.org/r/20220104170505.10248-1-msuchanek@suse.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 00eb74e commit 358fcf5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/debugfs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static int debugfs_locked_down(struct inode *inode,
147147
struct file *filp,
148148
const struct file_operations *real_fops)
149149
{
150-
if ((inode->i_mode & 07777) == 0444 &&
150+
if ((inode->i_mode & 07777 & ~0444) == 0 &&
151151
!(filp->f_mode & FMODE_WRITE) &&
152152
!real_fops->unlocked_ioctl &&
153153
!real_fops->compat_ioctl &&

0 commit comments

Comments
 (0)