cgroup: set css->id to -1 during init
authorTejun Heo <tj@kernel.org>
Thu, 26 May 2016 19:42:13 +0000 (15:42 -0400)
committerTejun Heo <tj@kernel.org>
Thu, 16 Jun 2016 21:59:35 +0000 (17:59 -0400)
commit8fa3b8d689a54d6d04ff7803c724fb7aca6ce98e
treec3da33dd0e95d606779ece7a984827dd530c660f
parentb00c52dae6d9ee8d0f2407118ef6544ae5524781
cgroup: set css->id to -1 during init

If percpu_ref initialization fails during css_create(), the free path
can end up trying to free css->id of zero.  As ID 0 is unused, it
doesn't cause a critical breakage but it does trigger a warning
message.  Fix it by setting css->id to -1 from init_and_link_css().

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Wenwei Tao <ww.tao0320@gmail.com>
Fixes: 01e586598b22 ("cgroup: release css->id after css_free")
Cc: stable@vger.kernel.org # v4.0+
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup.c