diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-01-09 02:38:23 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-01-09 02:38:23 -0500 |
commit | da733563be5a9da26fe81d9f007262d00b846e22 (patch) | |
tree | db28291df94a2043af2123911984c5c173da4e6f /kernel/cred.c | |
parent | 6ccbcf2cb41131f8d56ef0723bf3f7c1f8486076 (diff) | |
parent | dab78d7924598ea4031663dd10db814e2e324928 (diff) |
Merge branch 'next' into for-linus
Diffstat (limited to 'kernel/cred.c')
-rw-r--r-- | kernel/cred.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/kernel/cred.c b/kernel/cred.c index 8ef31f53c44c..5791612a4045 100644 --- a/kernel/cred.c +++ b/kernel/cred.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * as published by the Free Software Foundation; either version | 8 | * as published by the Free Software Foundation; either version |
9 | * 2 of the Licence, or (at your option) any later version. | 9 | * 2 of the Licence, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | #include <linux/module.h> | 11 | #include <linux/export.h> |
12 | #include <linux/cred.h> | 12 | #include <linux/cred.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
@@ -644,6 +644,9 @@ void __init cred_init(void) | |||
644 | */ | 644 | */ |
645 | struct cred *prepare_kernel_cred(struct task_struct *daemon) | 645 | struct cred *prepare_kernel_cred(struct task_struct *daemon) |
646 | { | 646 | { |
647 | #ifdef CONFIG_KEYS | ||
648 | struct thread_group_cred *tgcred; | ||
649 | #endif | ||
647 | const struct cred *old; | 650 | const struct cred *old; |
648 | struct cred *new; | 651 | struct cred *new; |
649 | 652 | ||
@@ -651,6 +654,14 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) | |||
651 | if (!new) | 654 | if (!new) |
652 | return NULL; | 655 | return NULL; |
653 | 656 | ||
657 | #ifdef CONFIG_KEYS | ||
658 | tgcred = kmalloc(sizeof(*tgcred), GFP_KERNEL); | ||
659 | if (!tgcred) { | ||
660 | kmem_cache_free(cred_jar, new); | ||
661 | return NULL; | ||
662 | } | ||
663 | #endif | ||
664 | |||
654 | kdebug("prepare_kernel_cred() alloc %p", new); | 665 | kdebug("prepare_kernel_cred() alloc %p", new); |
655 | 666 | ||
656 | if (daemon) | 667 | if (daemon) |
@@ -667,8 +678,11 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) | |||
667 | get_group_info(new->group_info); | 678 | get_group_info(new->group_info); |
668 | 679 | ||
669 | #ifdef CONFIG_KEYS | 680 | #ifdef CONFIG_KEYS |
670 | atomic_inc(&init_tgcred.usage); | 681 | atomic_set(&tgcred->usage, 1); |
671 | new->tgcred = &init_tgcred; | 682 | spin_lock_init(&tgcred->lock); |
683 | tgcred->process_keyring = NULL; | ||
684 | tgcred->session_keyring = NULL; | ||
685 | new->tgcred = tgcred; | ||
672 | new->request_key_auth = NULL; | 686 | new->request_key_auth = NULL; |
673 | new->thread_keyring = NULL; | 687 | new->thread_keyring = NULL; |
674 | new->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING; | 688 | new->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING; |