|
@@ -2905,9 +2905,14 @@ static void cgroup_enable_task_cg_lists(void)
|
|
|
* We should check if the process is exiting, otherwise
|
|
|
* it will race with cgroup_exit() in that the list
|
|
|
* entry won't be deleted though the process has exited.
|
|
|
+ * Do it while holding siglock so that we don't end up
|
|
|
+ * racing against cgroup_exit().
|
|
|
*/
|
|
|
+ spin_lock_irq(&p->sighand->siglock);
|
|
|
if (!(p->flags & PF_EXITING) && list_empty(&p->cg_list))
|
|
|
list_add(&p->cg_list, &task_css_set(p)->tasks);
|
|
|
+ spin_unlock_irq(&p->sighand->siglock);
|
|
|
+
|
|
|
task_unlock(p);
|
|
|
} while_each_thread(g, p);
|
|
|
read_unlock(&tasklist_lock);
|