• 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
    update_if_frozen.
    
    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:
    http://pentium.hopto.o...
    2d3cbf8b
cgroup_freezer.c 9.44 KB