]> git.baikalelectronics.ru Git - kernel.git/commit
cgroup: make sure that decisions in __css_put are atomic
authorSalman Qazi <sqazi@google.com>
Thu, 7 Jun 2012 01:51:35 +0000 (18:51 -0700)
committerTejun Heo <tj@kernel.org>
Thu, 7 Jun 2012 01:51:35 +0000 (18:51 -0700)
commit6bbeb5bf92c5c18c1205ce68d87a2be5fe2d798a
tree143a9493c9a81db130b313c0c46d87a909485541
parentab8959ff9704d41a565481f63a237597cf21a997
cgroup: make sure that decisions in __css_put are atomic

__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: Salman Qazi <sqazi@google.com>
Acked-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
kernel/cgroup.c