Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

sysctl: no-child: manually register kernel/keys

Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
  • Loading branch information...
commit 4efaa1511c84838d34e45244f37ebfa876dfcf15 1 parent 39163fe
@luciang authored
View
3  include/linux/key.h
@@ -293,9 +293,6 @@ static inline bool key_is_instantiated(const struct key *key)
(rcu_dereference_protected((KEY)->payload.rcudata, \
rwsem_is_locked(&((struct key *)(KEY))->sem)))
-#ifdef CONFIG_SYSCTL
-extern ctl_table key_sysctls[];
-#endif
extern void key_replace_session_keyring(void);
View
7 kernel/sysctl.c
@@ -920,13 +920,6 @@ static struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = proc_dostring,
},
-#ifdef CONFIG_KEYS
- {
- .procname = "keys",
- .mode = 0555,
- .child = key_sysctls,
- },
-#endif
#ifdef CONFIG_RCU_TORTURE_TEST
{
.procname = "rcutorture_runnable",
View
7 security/keys/key.c
@@ -983,11 +983,18 @@ void unregister_key_type(struct key_type *ktype)
}
EXPORT_SYMBOL(unregister_key_type);
+#ifdef CONFIG_SYSCTL
+extern int __init key_register_sysctls(void);
+#endif
+
/*
* Initialise the key management state.
*/
void __init key_init(void)
{
+#ifdef CONFIG_SYSCTL
+ key_register_sysctls();
+#endif
/* allocate a slab in which we can store keys */
key_jar = kmem_cache_create("key_jar", sizeof(struct key),
0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
View
18 security/keys/sysctl.c
@@ -15,7 +15,7 @@
static const int zero, one = 1, max = INT_MAX;
-ctl_table key_sysctls[] = {
+static struct ctl_table key_table[] = {
{
.procname = "maxkeys",
.data = &key_quota_maxkeys,
@@ -63,3 +63,19 @@ ctl_table key_sysctls[] = {
},
{ }
};
+
+static const __initdata struct ctl_path key_path[] = {
+ { .procname = "kernel" },
+ { .procname = "keys" },
+ { }
+};
+
+static struct ctl_table_header *key_header;
+
+int __init key_register_sysctls(void)
+{
+ key_header = register_sysctl_paths(key_path, key_table);
+ if (key_header == NULL)
+ return -ENOMEM;
+ return 0;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.