mirror of https://gitee.com/openkylin/linux.git
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: 01e586598b
("cgroup: release css->id after css_free")
Cc: stable@vger.kernel.org # v4.0+
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
b00c52dae6
commit
8fa3b8d689
|
@ -5063,6 +5063,7 @@ static void init_and_link_css(struct cgroup_subsys_state *css,
|
||||||
memset(css, 0, sizeof(*css));
|
memset(css, 0, sizeof(*css));
|
||||||
css->cgroup = cgrp;
|
css->cgroup = cgrp;
|
||||||
css->ss = ss;
|
css->ss = ss;
|
||||||
|
css->id = -1;
|
||||||
INIT_LIST_HEAD(&css->sibling);
|
INIT_LIST_HEAD(&css->sibling);
|
||||||
INIT_LIST_HEAD(&css->children);
|
INIT_LIST_HEAD(&css->children);
|
||||||
css->serial_nr = css_serial_nr_next++;
|
css->serial_nr = css_serial_nr_next++;
|
||||||
|
|
Loading…
Reference in New Issue