diff options
author | Tejun Heo <tj@kernel.org> | 2016-05-26 22:42:13 +0300 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-06-17 00:59:35 +0300 |
commit | 8fa3b8d689a54d6d04ff7803c724fb7aca6ce98e (patch) | |
tree | c3da33dd0e95d606779ece7a984827dd530c660f /kernel/cgroup.c | |
parent | b00c52dae6d9ee8d0f2407118ef6544ae5524781 (diff) | |
download | linux-8fa3b8d689a54d6d04ff7803c724fb7aca6ce98e.tar.xz |
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>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 789b84f973c9..688eb0cd1851 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -5063,6 +5063,7 @@ static void init_and_link_css(struct cgroup_subsys_state *css, memset(css, 0, sizeof(*css)); css->cgroup = cgrp; css->ss = ss; + css->id = -1; INIT_LIST_HEAD(&css->sibling); INIT_LIST_HEAD(&css->children); css->serial_nr = css_serial_nr_next++; |