[PATCH] vm_is_stack: use for_each_thread() rather then buggy while_each_thread()
From: Oleg Nesterov
Date: Thu Aug 07 2014 - 15:49:37 EST
Aleksei hit the soft lockup during reading /proc/PID/smaps.
David investigated the problem and suggested the right fix.
while_each_thread() is racy and should die, this patch updates
vm_is_stack().
Reported-and-tested-by: Aleksei Besogonov <alex.besogonov@xxxxxxxxx>
Suggested-by: David Rientjes <rientjes@xxxxxxxxxx>
Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
mm/util.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/mm/util.c b/mm/util.c
index d5ea733..33e9f44 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -277,17 +277,14 @@ pid_t vm_is_stack(struct task_struct *task,
if (in_group) {
struct task_struct *t;
- rcu_read_lock();
- if (!pid_alive(task))
- goto done;
- t = task;
- do {
+ rcu_read_lock();
+ for_each_thread(task, t) {
if (vm_is_stack_for_task(t, vma)) {
ret = t->pid;
goto done;
}
- } while_each_thread(task, t);
+ }
done:
rcu_read_unlock();
}
--
1.5.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/