• Salman Qazi's avatar
    cgroup: make sure that decisions in __css_put are atomic · 967db0ea
    Salman Qazi authored
    __css_put is using atomic_dec on the ref count, and then
    looking at the ref count to make decisions.  This is prone
    to races, as someone else may decrement ref count between
    our decrement and our decision.  Instead, we should base our
    decisions on the value that we decremented the ref count to.
    
    (This results in an actual race on Google's kernel which I
    haven't been able to reproduce on the upstream kernel.  Having
    said that, it's still incorrect by inspection).
    Signed-off-by: default avatarSalman Qazi <sqazi@google.com>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Cc: stable@vger.kernel.org
    967db0ea
cgroup.c 146 KB