Skip to content

Commit a10a923

Browse files
scottmayhewamschuma-ntap
authored andcommitted
NFS: Use parent's objective cred in nfs_access_login_time()
The subjective cred (task->cred) can potentially be overridden and subsquently freed in non-RCU context, which could lead to a panic if we try to use it in cred_fscmp(). Use __task_cred(), which returns the objective cred (task->real_cred) instead. Fixes: 0eb4381 ("NFS: Clear the file access cache upon login") Fixes: 5e9a7b9 ("NFS: Fix up a sparse warning") Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent b4d4fd6 commit a10a923

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/nfs/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2963,7 +2963,7 @@ static u64 nfs_access_login_time(const struct task_struct *task,
29632963
rcu_read_lock();
29642964
for (;;) {
29652965
parent = rcu_dereference(task->real_parent);
2966-
pcred = rcu_dereference(parent->cred);
2966+
pcred = __task_cred(parent);
29672967
if (parent == task || cred_fscmp(pcred, cred) != 0)
29682968
break;
29692969
task = parent;

0 commit comments

Comments
 (0)