[PATCH 5.11 326/329] debugfs: Make debugfs_allow RO after init

From
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date
2021-05-17 16:05:25
Also in
lkml
Reply to
Greg Kroah-Hartman, 2021-05-17
From: Kees Cook <redacted>

commit 312723a0b34d6d110aa4427a982536bb36ab8471 upstream.

Since debugfs_allow is only set at boot time during __init, make it
read-only after being set.

Fixes: a24c6f7bc923 ("debugfs: Add access restriction option")
Cc: Peter Enderborg <redacted>
Reviewed-by: Peter Enderborg <redacted>
Signed-off-by: Kees Cook <redacted>
Link: https://lore.kernel.org/r/20210405213959.3079432-1-keescook@chromium.org (local)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/debugfs/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -35,7 +35,7 @@
 static struct vfsmount *debugfs_mount;
 static int debugfs_mount_count;
 static bool debugfs_registered;
-static unsigned int debugfs_allow = DEFAULT_DEBUGFS_ALLOW_BITS;
+static unsigned int debugfs_allow __ro_after_init = DEFAULT_DEBUGFS_ALLOW_BITS;
 
 /*
  * Don't allow access attributes to be changed whilst the kernel is locked down

Thread (337 messages) 337 messages, 8 authors, last reply 2021-05-18
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help