diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-12-10 18:45:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:09 -0500 |
commit | 4af1036df4dd4f0d59fad9d82ed456bfa2e73fa6 (patch) | |
tree | db1e1ccc62ddffb35e429d9d306752a27ac4d9de | |
parent | 2fc1e948e820bddf8a686c6e2989219b471d7982 (diff) |
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 <oleg@redhat.com>
Cc: Aaron Tomlin <atomlin@redhat.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Cc: Sterling Alexander <stalexan@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/proc/array.c | 3 |
1 files changed, 1 insertions, 2 deletions
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, | |||
201 | "FDSize:\t%d\n" | 201 | "FDSize:\t%d\n" |
202 | "Groups:\t", | 202 | "Groups:\t", |
203 | fdt ? fdt->max_fds : 0); | 203 | fdt ? fdt->max_fds : 0); |
204 | task_unlock(p); | ||
204 | rcu_read_unlock(); | 205 | rcu_read_unlock(); |
205 | 206 | ||
206 | group_info = cred->group_info; | 207 | group_info = cred->group_info; |
207 | task_unlock(p); | ||
208 | |||
209 | for (g = 0; g < group_info->ngroups; g++) | 208 | for (g = 0; g < group_info->ngroups; g++) |
210 | seq_printf(m, "%d ", | 209 | seq_printf(m, "%d ", |
211 | from_kgid_munged(user_ns, GROUP_AT(group_info, g))); | 210 | from_kgid_munged(user_ns, GROUP_AT(group_info, g))); |