]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
KEYS: Make request key instantiate the per-user keyrings
authorDavid Howells <dhowells@redhat.com>
Mon, 10 Nov 2008 19:00:05 +0000 (19:00 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 10 Nov 2008 21:20:57 +0000 (13:20 -0800)
Make request_key() instantiate the per-user keyrings so that it doesn't oops
if it needs to get hold of the user session keyring because there isn't a
session keyring in place.

Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Steve French <smfrench@gmail.com>
Tested-by: Rutger Nijlunsing <rutger.nijlunsing@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
security/keys/internal.h
security/keys/process_keys.c
security/keys/request_key.c

index b39f5c2e2c4b1d5874196f3954f65ea494af391c..239098f0fd763f846b593de4432f4b887f3fa702 100644 (file)
@@ -107,6 +107,7 @@ extern key_ref_t search_process_keyrings(struct key_type *type,
 
 extern struct key *find_keyring_by_name(const char *name, bool skip_perm_check);
 
+extern int install_user_keyrings(struct task_struct *tsk);
 extern int install_thread_keyring(struct task_struct *tsk);
 extern int install_process_keyring(struct task_struct *tsk);
 
index 5be6d018759abf43d469bc786d04305223464574..45b240af6dbe2cd1a9dd22b665e60590e0066a15 100644 (file)
@@ -40,7 +40,7 @@ struct key_user root_key_user = {
 /*
  * install user and user session keyrings for a particular UID
  */
-static int install_user_keyrings(struct task_struct *tsk)
+int install_user_keyrings(struct task_struct *tsk)
 {
        struct user_struct *user = tsk->user;
        struct key *uid_keyring, *session_keyring;
index ba32ca6469bdf2e74a8b0f9cb94d27604b7251af..abea08f87fe20e4dc14b75bea5c7bbe67c659ba3 100644 (file)
@@ -74,6 +74,10 @@ static int call_sbin_request_key(struct key_construction *cons,
 
        kenter("{%d},{%d},%s", key->serial, authkey->serial, op);
 
+       ret = install_user_keyrings(tsk);
+       if (ret < 0)
+               goto error_alloc;
+
        /* allocate a new session keyring */
        sprintf(desc, "_req.%u", key->serial);