summaryrefslogtreecommitdiff
path: root/security/keys/process_keys.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2012-01-08 23:38:23 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-01-08 23:38:23 -0800
commitda733563be5a9da26fe81d9f007262d00b846e22 (patch)
treedb28291df94a2043af2123911984c5c173da4e6f /security/keys/process_keys.c
parent6ccbcf2cb41131f8d56ef0723bf3f7c1f8486076 (diff)
parentdab78d7924598ea4031663dd10db814e2e324928 (diff)
downloadlinux-3.10-da733563be5a9da26fe81d9f007262d00b846e22.tar.gz
linux-3.10-da733563be5a9da26fe81d9f007262d00b846e22.tar.bz2
linux-3.10-da733563be5a9da26fe81d9f007262d00b846e22.zip
Merge branch 'next' into for-linus
Diffstat (limited to 'security/keys/process_keys.c')
-rw-r--r--security/keys/process_keys.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index a3063eb3dc2..1068cb1939b 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -270,7 +270,7 @@ static int install_session_keyring(struct key *keyring)
if (!new)
return -ENOMEM;
- ret = install_session_keyring_to_cred(new, NULL);
+ ret = install_session_keyring_to_cred(new, keyring);
if (ret < 0) {
abort_creds(new);
return ret;
@@ -589,12 +589,22 @@ try_again:
ret = install_user_keyrings();
if (ret < 0)
goto error;
- ret = install_session_keyring(
- cred->user->session_keyring);
+ if (lflags & KEY_LOOKUP_CREATE)
+ ret = join_session_keyring(NULL);
+ else
+ ret = install_session_keyring(
+ cred->user->session_keyring);
if (ret < 0)
goto error;
goto reget_creds;
+ } else if (cred->tgcred->session_keyring ==
+ cred->user->session_keyring &&
+ lflags & KEY_LOOKUP_CREATE) {
+ ret = join_session_keyring(NULL);
+ if (ret < 0)
+ goto error;
+ goto reget_creds;
}
rcu_read_lock();