|
35 | 35 | static struct vfsmount *debugfs_mount; |
36 | 36 | static int debugfs_mount_count; |
37 | 37 | static bool debugfs_registered; |
38 | | -static unsigned int debugfs_allow __ro_after_init = DEFAULT_DEBUGFS_ALLOW_BITS; |
| 38 | +static bool debugfs_enabled __ro_after_init = IS_ENABLED(DEBUG_FS_ALLOW_ALL); |
39 | 39 |
|
40 | 40 | /* |
41 | 41 | * Don't allow access attributes to be changed whilst the kernel is locked down |
@@ -365,7 +365,7 @@ static struct dentry *debugfs_start_creating(const char *name, |
365 | 365 | struct dentry *dentry; |
366 | 366 | int error; |
367 | 367 |
|
368 | | - if (!(debugfs_allow & DEBUGFS_ALLOW_API)) |
| 368 | + if (!debugfs_enabled) |
369 | 369 | return ERR_PTR(-EPERM); |
370 | 370 |
|
371 | 371 | if (!debugfs_initialized()) |
@@ -885,21 +885,25 @@ static int __init debugfs_kernel(char *str) |
885 | 885 | { |
886 | 886 | if (str) { |
887 | 887 | if (!strcmp(str, "on")) |
888 | | - debugfs_allow = DEBUGFS_ALLOW_API | DEBUGFS_ALLOW_MOUNT; |
889 | | - else if (!strcmp(str, "no-mount")) |
890 | | - debugfs_allow = DEBUGFS_ALLOW_API; |
| 888 | + debugfs_enabled = true; |
891 | 889 | else if (!strcmp(str, "off")) |
892 | | - debugfs_allow = 0; |
| 890 | + debugfs_enabled = false; |
| 891 | + else if (!strcmp(str, "no-mount")) { |
| 892 | + pr_notice("debugfs=no-mount is a deprecated alias " |
| 893 | + "for debugfs=off\n"); |
| 894 | + debugfs_enabled = false; |
| 895 | + } |
893 | 896 | } |
894 | 897 |
|
895 | 898 | return 0; |
896 | 899 | } |
897 | 900 | early_param("debugfs", debugfs_kernel); |
| 901 | + |
898 | 902 | static int __init debugfs_init(void) |
899 | 903 | { |
900 | 904 | int retval; |
901 | 905 |
|
902 | | - if (!(debugfs_allow & DEBUGFS_ALLOW_MOUNT)) |
| 906 | + if (!debugfs_enabled) |
903 | 907 | return -EPERM; |
904 | 908 |
|
905 | 909 | retval = sysfs_create_mount_point(kernel_kobj, "debug"); |
|
0 commit comments