@@ -142,18 +142,21 @@ EXPORT_SYMBOL_GPL(debugfs_file_put);
142
142
* We also need to exclude any file that has ways to write or alter it as root
143
143
* can bypass the permissions check.
144
144
*/
145
- static bool debugfs_is_locked_down (struct inode * inode ,
146
- struct file * filp ,
147
- const struct file_operations * real_fops )
145
+ static int debugfs_locked_down (struct inode * inode ,
146
+ struct file * filp ,
147
+ const struct file_operations * real_fops )
148
148
{
149
149
if ((inode -> i_mode & 07777 ) == 0444 &&
150
150
!(filp -> f_mode & FMODE_WRITE ) &&
151
151
!real_fops -> unlocked_ioctl &&
152
152
!real_fops -> compat_ioctl &&
153
153
!real_fops -> mmap )
154
- return false ;
154
+ return 0 ;
155
155
156
- return security_locked_down (LOCKDOWN_DEBUGFS );
156
+ if (security_locked_down (LOCKDOWN_DEBUGFS ))
157
+ return - EPERM ;
158
+
159
+ return 0 ;
157
160
}
158
161
159
162
static int open_proxy_open (struct inode * inode , struct file * filp )
@@ -168,7 +171,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp)
168
171
169
172
real_fops = debugfs_real_fops (filp );
170
173
171
- r = debugfs_is_locked_down (inode , filp , real_fops );
174
+ r = debugfs_locked_down (inode , filp , real_fops );
172
175
if (r )
173
176
goto out ;
174
177
@@ -298,7 +301,7 @@ static int full_proxy_open(struct inode *inode, struct file *filp)
298
301
299
302
real_fops = debugfs_real_fops (filp );
300
303
301
- r = debugfs_is_locked_down (inode , filp , real_fops );
304
+ r = debugfs_locked_down (inode , filp , real_fops );
302
305
if (r )
303
306
goto out ;
304
307
0 commit comments