Commit 4d42378e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] key_init ordering fix

The data structures which are set up by key_init() are used by exec().  And
we're using exec() super-early via the hotplug events from
do_basic_setup():driver_init().

So call key_init() directly, prior to driver_init().

Cc: David S. Miller <davem@davemloft.net>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c1ec9cae
......@@ -263,6 +263,7 @@ extern int suid_keys(struct task_struct *tsk);
extern int exec_keys(struct task_struct *tsk);
extern void key_fsuid_changed(struct task_struct *tsk);
extern void key_fsgid_changed(struct task_struct *tsk);
extern void key_init(void);
#else /* CONFIG_KEYS */
......@@ -278,6 +279,7 @@ extern void key_fsgid_changed(struct task_struct *tsk);
#define exec_keys(t) do { } while(0)
#define key_fsuid_changed(t) do { } while(0)
#define key_fsgid_changed(t) do { } while(0)
#define key_init() do { } while(0)
#endif /* CONFIG_KEYS */
#endif /* __KERNEL__ */
......
......@@ -45,6 +45,7 @@
#include <linux/unistd.h>
#include <linux/rmap.h>
#include <linux/mempolicy.h>
#include <linux/key.h>
#include <asm/io.h>
#include <asm/bugs.h>
......@@ -639,7 +640,7 @@ static void __init do_basic_setup(void)
/* drivers will send hotplug events */
init_workqueues();
usermodehelper_init();
key_init();
driver_init();
#ifdef CONFIG_SYSCTL
......
......@@ -998,13 +998,11 @@ EXPORT_SYMBOL(unregister_key_type);
/*
* initialise the key management stuff
*/
static int __init key_init(void)
void __init key_init(void)
{
/* allocate a slab in which we can store keys */
key_jar = kmem_cache_create("key_jar", sizeof(struct key),
0, SLAB_HWCACHE_ALIGN, NULL, NULL);
if (!key_jar)
panic("Cannot create key jar\n");
0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
/* add the special key types */
list_add_tail(&key_type_keyring.link, &key_types_list);
......@@ -1031,9 +1029,4 @@ static int __init key_init(void)
/* link the two root keyrings together */
key_link(&root_session_keyring, &root_user_keyring);
return 0;
} /* end key_init() */
security_initcall(key_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment