summaryrefslogtreecommitdiffstats
path: root/kernel/cred.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-05-22 15:06:51 +0200
committerDavid Howells <dhowells@redhat.com>2019-05-22 15:06:51 +0200
commit2e21865faf4fd7ca99eb2ace072c6d618059e342 (patch)
treecb05e816e95bc4785b7c601b2f33d3ad6396e1fc /kernel/cred.c
parentLinux 5.2-rc1 (diff)
downloadlinux-2e21865faf4fd7ca99eb2ace072c6d618059e342.tar.xz
linux-2e21865faf4fd7ca99eb2ace072c6d618059e342.zip
keys: sparse: Fix key_fs[ug]id_changed()
Sparse warnings are incurred by key_fs[ug]id_changed() due to unprotected accesses of tsk->cred, which is marked __rcu. Fix this by passing the new cred struct to these functions from commit_creds() rather than the task pointer. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: James Morris <jamorris@linux.microsoft.com>
Diffstat (limited to 'kernel/cred.c')
-rw-r--r--kernel/cred.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/cred.c b/kernel/cred.c
index 45d77284aed0..3bd40de9e192 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -455,9 +455,9 @@ int commit_creds(struct cred *new)
/* alter the thread keyring */
if (!uid_eq(new->fsuid, old->fsuid))
- key_fsuid_changed(task);
+ key_fsuid_changed(new);
if (!gid_eq(new->fsgid, old->fsgid))
- key_fsgid_changed(task);
+ key_fsgid_changed(new);
/* do it
* RLIMIT_NPROC limits on user->processes have already been checked