Home
last modified time | relevance | path

Searched hist:a872ff0c (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/fs/proc/
H A Dbase.ca872ff0c 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>
a872ff0c 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>