Skip to content

Commit

Permalink
include/linux/pid.h: use for_each_thread() in do_each_pid_thread()
Browse files Browse the repository at this point in the history
while_each_pid_thread() is using while_each_thread(), which is unsafe
under RCU lock according to commit 0c740d0 ("introduce
for_each_thread() to replace the buggy while_each_thread()").  Use
for_each_thread() in do_each_pid_thread() which is safe under RCU lock.

Link: http://lkml.kernel.org/r/201702011947.DBD56740.OMVHOLOtSJFFFQ@I-love.SAKURA.ne.jp
Link: http://lkml.kernel.org/r/1486041779-4401-2-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Tetsuo Handa authored and Linus Torvalds committed Feb 28, 2017
1 parent 369f267 commit e3b5a34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/pid.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ pid_t pid_vnr(struct pid *pid);
#define do_each_pid_thread(pid, type, task) \
do_each_pid_task(pid, type, task) { \
struct task_struct *tg___ = task; \
do {
for_each_thread(tg___, task) {

#define while_each_pid_thread(pid, type, task) \
} while_each_thread(tg___, task); \
} \
task = tg___; \
} while_each_pid_task(pid, type, task)
#endif /* _LINUX_PID_H */

0 comments on commit e3b5a34

Please sign in to comment.