summaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorAnton Vorontsov <anton.vorontsov@linaro.org>2012-05-31 16:26:25 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 17:49:30 -0700
commit9bd0a077122a6b15069aab7a59c8f50f736fa1dd (patch)
treef76eefc0b3bdb46a01e394cecbf9ac42935bc4cc /arch/um
parentaf1be5a578a1ccc9961c55290f8c509a00a69036 (diff)
downloadop-kernel-dev-9bd0a077122a6b15069aab7a59c8f50f736fa1dd.zip
op-kernel-dev-9bd0a077122a6b15069aab7a59c8f50f736fa1dd.tar.gz
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')
-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 4d93dff..66d754c 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -4,6 +4,7 @@
*/
#include "linux/sched.h"
+#include "linux/spinlock.h"
#include "linux/slab.h"
#include "kern_util.h"
#include "os.h"
@@ -22,6 +23,7 @@ static void kill_off_processes(void)
struct task_struct *p;
int pid;
+ read_lock(&tasklist_lock);
for_each_process(p) {
if (p->mm == NULL)
continue;
@@ -29,6 +31,7 @@ static void kill_off_processes(void)
pid = p->mm->context.id.u.pid;
os_kill_ptraced_process(pid, 1);
}
+ read_unlock(&tasklist_lock);
}
}
OpenPOWER on IntegriCloud