aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys')
-rw-r--r--security/keys/process_keys.c2
-rw-r--r--security/keys/request_key.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index b0904cdda2e7..ce8ac6073d57 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -582,7 +582,7 @@ key_ref_t lookup_user_key(key_serial_t id, int create, int partial,
582{ 582{
583 struct request_key_auth *rka; 583 struct request_key_auth *rka;
584 struct task_struct *t = current; 584 struct task_struct *t = current;
585 struct cred *cred = t->cred; 585 struct cred *cred = current_cred();
586 struct key *key; 586 struct key *key;
587 key_ref_t key_ref, skey_ref; 587 key_ref_t key_ref, skey_ref;
588 int ret; 588 int ret;
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 3e9b9eb1dd28..0488b0af5bd6 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -67,6 +67,7 @@ static int call_sbin_request_key(struct key_construction *cons,
67 void *aux) 67 void *aux)
68{ 68{
69 struct task_struct *tsk = current; 69 struct task_struct *tsk = current;
70 const struct cred *cred = current_cred();
70 key_serial_t prkey, sskey; 71 key_serial_t prkey, sskey;
71 struct key *key = cons->key, *authkey = cons->authkey, *keyring; 72 struct key *key = cons->key, *authkey = cons->authkey, *keyring;
72 char *argv[9], *envp[3], uid_str[12], gid_str[12]; 73 char *argv[9], *envp[3], uid_str[12], gid_str[12];
@@ -96,16 +97,16 @@ static int call_sbin_request_key(struct key_construction *cons,
96 goto error_link; 97 goto error_link;
97 98
98 /* record the UID and GID */ 99 /* record the UID and GID */
99 sprintf(uid_str, "%d", current_fsuid()); 100 sprintf(uid_str, "%d", cred->fsuid);
100 sprintf(gid_str, "%d", current_fsgid()); 101 sprintf(gid_str, "%d", cred->fsgid);
101 102
102 /* we say which key is under construction */ 103 /* we say which key is under construction */
103 sprintf(key_str, "%d", key->serial); 104 sprintf(key_str, "%d", key->serial);
104 105
105 /* we specify the process's default keyrings */ 106 /* we specify the process's default keyrings */
106 sprintf(keyring_str[0], "%d", 107 sprintf(keyring_str[0], "%d",
107 tsk->cred->thread_keyring ? 108 cred->thread_keyring ?
108 tsk->cred->thread_keyring->serial : 0); 109 cred->thread_keyring->serial : 0);
109 110
110 prkey = 0; 111 prkey = 0;
111 if (tsk->signal->process_keyring) 112 if (tsk->signal->process_keyring)
@@ -118,7 +119,7 @@ static int call_sbin_request_key(struct key_construction *cons,
118 sskey = rcu_dereference(tsk->signal->session_keyring)->serial; 119 sskey = rcu_dereference(tsk->signal->session_keyring)->serial;
119 rcu_read_unlock(); 120 rcu_read_unlock();
120 } else { 121 } else {
121 sskey = tsk->cred->user->session_keyring->serial; 122 sskey = cred->user->session_keyring->serial;
122 } 123 }
123 124
124 sprintf(keyring_str[2], "%d", sskey); 125 sprintf(keyring_str[2], "%d", sskey);