Searched hist:a872ff0cb2218dc9688b990c5ccda064dc40946b (Results 1 – 1 of 1) sorted by relevance
/openbmc/linux/fs/proc/ |
H A D | base.c | diff a872ff0cb2218dc9688b990c5ccda064dc40946b Mon Jun 26 02:26:01 CDT 2006 Oleg Nesterov <oleg@tv-sign.ru> [PATCH] simplify/fix first_tid()
first_tid:
/* If nr exceeds the number of threads there is nothing todo */ if (nr) { if (nr >= get_nr_threads(leader)) goto done; }
This is not reliable: sub-threads can exit after this check, so the 'for' loop below can overlap and proc_task_readdir() can return an already filldir'ed dirents.
for (; pos && pid_alive(pos); pos = next_thread(pos)) { if (--nr > 0) continue;
Off-by-one error, will return 'leader' when nr == 1.
This patch tries to fix these problems and simplify the code.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|