aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys/proc.c')
-rw-r--r--security/keys/proc.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/security/keys/proc.c b/security/keys/proc.c
index bf08d02b6646..de834309d100 100644
--- a/security/keys/proc.c
+++ b/security/keys/proc.c
@@ -187,7 +187,7 @@ static int proc_keys_show(struct seq_file *m, void *v)
187 struct keyring_search_context ctx = { 187 struct keyring_search_context ctx = {
188 .index_key.type = key->type, 188 .index_key.type = key->type,
189 .index_key.description = key->description, 189 .index_key.description = key->description,
190 .cred = current_cred(), 190 .cred = m->file->f_cred,
191 .match_data.cmp = lookup_user_key_possessed, 191 .match_data.cmp = lookup_user_key_possessed,
192 .match_data.raw_data = key, 192 .match_data.raw_data = key,
193 .match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT, 193 .match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT,
@@ -207,11 +207,7 @@ static int proc_keys_show(struct seq_file *m, void *v)
207 } 207 }
208 } 208 }
209 209
210 /* check whether the current task is allowed to view the key (assuming 210 /* check whether the current task is allowed to view the key */
211 * non-possession)
212 * - the caller holds a spinlock, and thus the RCU read lock, making our
213 * access to __current_cred() safe
214 */
215 rc = key_task_permission(key_ref, ctx.cred, KEY_NEED_VIEW); 211 rc = key_task_permission(key_ref, ctx.cred, KEY_NEED_VIEW);
216 if (rc < 0) 212 if (rc < 0)
217 return 0; 213 return 0;