cgroup_freezer: fix can_attach() to prohibit moving from/to freezing/frozen cgroups
authorTomasz Buchert <tomasz.buchert@inria.fr>
Wed, 27 Oct 2010 22:33:33 +0000 (15:33 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Oct 2010 01:03:08 +0000 (18:03 -0700)
commit0bdba580ab052a21e3eda2764ed22d9ee962392b
tree9d8fb958c8612a9c72b8662d9b51c12c76ccd0bb
parentd5de4ddb1bc430289bede76c0d87cabee93f749a
cgroup_freezer: fix can_attach() to prohibit moving from/to freezing/frozen cgroups

It is possible to move a task from its cgroup even if this group is
'FREEZING'.  This results in a nasty bug - the moved task will become
frozen OUTSIDE its original cgroup and will remain in a permanent 'D'
state.

This patch allows to migrate the task only between THAWED cgroups.

This behavior was observed and easily reproduced on a single core laptop.
Notice that reproducibility depends highly on the machine used.  Program
and instructions how to reproduce the bug can be fetched from:
http://pentium.hopto.org/~thinred/repos/linux-misc/freezer_bug.c

Signed-off-by: Tomasz Buchert <tomasz.buchert@inria.fr>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/cgroup_freezer.c