aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2023-05-28 13:54:20 -0700
committerLuis Chamberlain <mcgrof@kernel.org>2023-05-28 13:58:39 -0700
commiteaea80f9cfe3faf34ae6835359153fabee95ebe1 (patch)
tree6e658f3c32f1fdd5de5c249fc9706f9f0ce0c045
parent12b2c1f142b8c41c00a923c7927b1dfcc0b2bb70 (diff)
downloadlinux-sysctl-testing.tar.gz
sysctl: move security keys sysctl registration to its own filesysctl-testing
The security keys sysctls are already declared on its own file, just move the sysctl registration to its own file to help avoid merge conflicts on sysctls.c, and help with clearing up sysctl.c further. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
-rw-r--r--include/linux/key.h3
-rw-r--r--kernel/sysctl.c4
-rw-r--r--security/keys/sysctl.c7
3 files changed, 7 insertions, 7 deletions
diff --git a/include/linux/key.h b/include/linux/key.h
index 8dc7f7c3088b9e..938d7ecfb495de 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -490,9 +490,6 @@ do { \
rcu_assign_pointer((KEY)->payload.rcu_data0, (PAYLOAD)); \
} while (0)
-#ifdef CONFIG_SYSCTL
-extern struct ctl_table key_sysctls[];
-#endif
/*
* the userspace interface
*/
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index caf4a91522a130..48046932d573b1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2322,10 +2322,6 @@ static struct ctl_table vm_table[] = {
int __init sysctl_init_bases(void)
{
register_sysctl_init("kernel", kern_table);
-#ifdef CONFIG_KEYS
- register_sysctl_init("kernel/keys", key_sysctls);
-#endif
-
register_sysctl_init("vm", vm_table);
return 0;
diff --git a/security/keys/sysctl.c b/security/keys/sysctl.c
index b46b651b3c4cc6..b72b82bb20c65e 100644
--- a/security/keys/sysctl.c
+++ b/security/keys/sysctl.c
@@ -68,3 +68,10 @@ struct ctl_table key_sysctls[] = {
#endif
{ }
};
+
+static int __init init_security_keys_sysctls(void)
+{
+ register_sysctl_init("kernel/keys", key_sysctls);
+ return 0;
+}
+early_initcall(init_security_keys_sysctls);