diff options
Diffstat (limited to 'security/keys/request_key.c')
-rw-r--r-- | security/keys/request_key.c | 11 |
1 files changed, 6 insertions, 5 deletions
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); |