Permalink
Browse files

cgroup: leave cg_list valid upon cgroup_exit

A thread/process in cgroup_attach_task() could have called
list_del(&tsk->cg_list) after cgroup_exit() had already called
list_del() on the same list. Since it only checked for
!list_empty(&tsk->cg_list) before doing this, the list_del()
call would thus be made twice.

The solution is to leave tsk->cg_list in a valid state in
cgroup_exit() with list_del_init(&tsk->cg_list), which leaves
an empty list.

Signed-off-by: Simon Wilson <simonwilson@google.com>
  • Loading branch information...
1 parent 0680fcd commit aa3041585df24b65bd800e3ce6aec5678d87f8e8 @tinyalsa tinyalsa committed Jan 8, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 kernel/cgroup.c
View
@@ -4129,7 +4129,7 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
if (!list_empty(&tsk->cg_list)) {
write_lock(&css_set_lock);
if (!list_empty(&tsk->cg_list))
- list_del(&tsk->cg_list);
+ list_del_init(&tsk->cg_list);
write_unlock(&css_set_lock);
}

0 comments on commit aa30415

Please sign in to comment.