• Tomasz Buchert's avatar
    cgroup_freezer: update_freezer_state() does incorrect state transitions · 2d3cbf8b
    Tomasz Buchert authored
    There are 4 state transitions possible for a freezer.  Only FREEZING ->
    FROZEN transaction is done lazily.  This patch allows update_freezer_state
    only to perform this transaction and renames the function to
    Moreover is_task_frozen_enough function is removed and its every occurence
    is replaced with frozen().  Therefore for a group to become FROZEN every
    task must be frozen.
    The previous version could trigger a following bug: When cgroup is in the
    process of freezing (but none of its tasks are frozen yet),
    update_freezer_state() (called from freezer_read or freezer_write) would
    incorrectly report that a group is 'THAWED' (because nfrozen = 0),
    allowing the transaction FREEZING -> THAWED without writing anything to
    'freezer.state'.  This is incorrect according to the documentation.  This
    could result in a 'THAWED' cgroup with frozen tasks inside.
    A code to reproduce this bug is available here:
    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: default avatarTomasz 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: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
cgroup_freezer.c 9.44 KB