diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-06-26 00:26:01 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 09:58:26 -0700 |
commit | a872ff0cb2218dc9688b990c5ccda064dc40946b (patch) | |
tree | ff94ae63e668f0229fc7aeed220def7e9708db3a /lib/idr.c | |
parent | cc288738c9ae3c64d3c50b86604044d1f6d22941 (diff) |
[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>
Diffstat (limited to 'lib/idr.c')
0 files changed, 0 insertions, 0 deletions