From f18c345ad1badb12fa2b1845f188f2f6ce9407f0 Mon Sep 17 00:00:00 2001 From: jianqiang Date: Thu, 28 Sep 2017 11:29:01 +0800 Subject: [PATCH] Add: tasklist_lock --- dump-phys.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dump-phys.c b/dump-phys.c index 41a4f6b..60a9e88 100644 --- a/dump-phys.c +++ b/dump-phys.c @@ -18,9 +18,11 @@ static struct task_struct *name_task_struct(char *name) { struct task_struct *task; + read_lock(&tasklist_lock); for_each_process(task) if (!strcmp(task->comm, name)) return task; + read_unlock(&tasklist_lock); return NULL; }