Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572361

[PATCH 2/2] pid: Use for_each_thread() in do_each_pid_thread()

From Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Newsgroups linux.kernel
Subject [PATCH 2/2] pid: Use for_each_thread() in do_each_pid_thread()
Date 2017-02-02 14:30 +0100
Message-ID <t6pCz-4Bc-47@gated-at.bofh.it> (permalink)
References <t6pCy-4Bc-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


while_each_pid_thread() is using while_each_thread(), which is unsafe
under RCU lock according to commit 0c740d0afc3bff0a ("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
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
---
 include/linux/pid.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/pid.h b/include/linux/pid.h
index 23705a5..298ead55 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -191,10 +191,10 @@ static inline pid_t pid_nr(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 */
-- 
1.8.3.1

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] block: Use for_each_thread() in sys_ioprio_set()/sys_ioprio_get() Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-02-02 14:30 +0100
  [PATCH 2/2] pid: Use for_each_thread() in do_each_pid_thread() Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-02-02 14:30 +0100

csiph-web