aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/reboot.c
diff options
context:
space:
mode:
authorAnton Vorontsov <anton.vorontsov@linaro.org>2012-05-31 19:26:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 20:49:30 -0400
commit9bd0a077122a6b15069aab7a59c8f50f736fa1dd (patch)
treef76eefc0b3bdb46a01e394cecbf9ac42935bc4cc /arch/um/kernel/reboot.c
parentaf1be5a578a1ccc9961c55290f8c509a00a69036 (diff)
um: should hold tasklist_lock while traversing processes
Traversing the tasks requires holding tasklist_lock, otherwise it is unsafe. p.s. However, I'm not sure that calling os_kill_ptraced_process() in the atomic context is correct. It seem to work, but please take a closer look. Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Cc: Richard Weinberger <richard@nod.at> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/kernel/reboot.c')
-rw-r--r--arch/um/kernel/reboot.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 4d93dff6b371..66d754c46e7b 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include "linux/sched.h" 6#include "linux/sched.h"
7#include "linux/spinlock.h"
7#include "linux/slab.h" 8#include "linux/slab.h"
8#include "kern_util.h" 9#include "kern_util.h"
9#include "os.h" 10#include "os.h"
@@ -22,6 +23,7 @@ static void kill_off_processes(void)
22 struct task_struct *p; 23 struct task_struct *p;
23 int pid; 24 int pid;
24 25
26 read_lock(&tasklist_lock);
25 for_each_process(p) { 27 for_each_process(p) {
26 if (p->mm == NULL) 28 if (p->mm == NULL)
27 continue; 29 continue;
@@ -29,6 +31,7 @@ static void kill_off_processes(void)
29 pid = p->mm->context.id.u.pid; 31 pid = p->mm->context.id.u.pid;
30 os_kill_ptraced_process(pid, 1); 32 os_kill_ptraced_process(pid, 1);
31 } 33 }
34 read_unlock(&tasklist_lock);
32 } 35 }
33} 36}
34 37