diff options
-rw-r--r-- | security/keys/proc.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/security/keys/proc.c b/security/keys/proc.c index 62a86e8cb907..0115fc283000 100644 --- a/security/keys/proc.c +++ b/security/keys/proc.c @@ -193,7 +193,7 @@ static int proc_keys_show(struct seq_file *m, void *v) struct keyring_search_context ctx = { .index_key.type = key->type, .index_key.description = key->description, - .cred = current_cred(), + .cred = m->file->f_cred, .match = lookup_user_key_possessed, .match_data = key, .flags = (KEYRING_SEARCH_NO_STATE_CHECK | @@ -213,11 +213,7 @@ static int proc_keys_show(struct seq_file *m, void *v) } } - /* check whether the current task is allowed to view the key (assuming - * non-possession) - * - the caller holds a spinlock, and thus the RCU read lock, making our - * access to __current_cred() safe - */ + /* check whether the current task is allowed to view the key */ rc = key_task_permission(key_ref, ctx.cred, KEY_NEED_VIEW); if (rc < 0) return 0; |