From: Oleg Nesterov Date: Wed, 10 Dec 2014 23:45:10 +0000 (-0800) Subject: proc: task_state: read cred->group_info outside of task_lock() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4af1036df4dd4f0d59fad9d82ed456bfa2e73fa6;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git proc: task_state: read cred->group_info outside of task_lock() task_state() reads cred->group_info under task_lock() because a long ago it was task_struct->group_info and it was actually protected by task->alloc_lock. Today this task_unlock() after rcu_read_unlock() just adds the confusion, move task_unlock() up. Signed-off-by: Oleg Nesterov Cc: Aaron Tomlin Cc: Alexey Dobriyan Cc: "Eric W. Biederman" , Cc: Sterling Alexander Cc: Peter Zijlstra Cc: Roland McGrath Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/array.c b/fs/proc/array.c index cd3653e4f35c..b5810c228c10 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -201,11 +201,10 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, "FDSize:\t%d\n" "Groups:\t", fdt ? fdt->max_fds : 0); + task_unlock(p); rcu_read_unlock(); group_info = cred->group_info; - task_unlock(p); - for (g = 0; g < group_info->ngroups; g++) seq_printf(m, "%d ", from_kgid_munged(user_ns, GROUP_AT(group_info, g)));