]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix do_each_task_pid() loop with 'continue' inside
authorKirill Korotaev <dev@sw.ru>
Fri, 3 Sep 2004 02:25:58 +0000 (19:25 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 3 Sep 2004 02:25:58 +0000 (19:25 -0700)
Dmitry Torokhov triggered a problem in the new pidhash macros: These
do_each_task_pid()/while_each_task_pid() do loop forever if you use a
'continue' inside them.

The end of the loop has to be inside the "while()" statement, so as to
not make "continue" jump over it.

include/linux/pid.h

index 5f74c4ab0d1143f715cddfaef290c082a3717c7a..5b2fcb19d2dae977f86818caaae4f25d8204d2bd 100644 (file)
@@ -46,10 +46,10 @@ extern void switch_exec_pids(struct task_struct *leader, struct task_struct *thr
                do {
 
 #define while_each_task_pid(who, type, task)                           \
-                       task = pid_task((task)->pids[type].pid_list.next,\
-                                               type);                  \
-                       prefetch((task)->pids[type].pid_list.next);     \
-               } while (hlist_unhashed(&(task)->pids[type].pid_chain));\
+               } while (task = pid_task((task)->pids[type].pid_list.next,\
+                                               type),                  \
+                       prefetch((task)->pids[type].pid_list.next),     \
+                       hlist_unhashed(&(task)->pids[type].pid_chain)); \
        }                                                               \
 
 #endif /* _LINUX_PID_H */