Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1407695

[PATCH cgroup/for-4.7-fixes] cgroup: set css->id to -1 during init

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject [PATCH cgroup/for-4.7-fixes] cgroup: set css->id to -1 during init
Date 2016-05-26 21:50 +0200
Message-ID <rD9s5-23a-1@gated-at.bofh.it> (permalink)
References <rymSZ-62Q-11@gated-at.bofh.it> <rD8Z3-1RG-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello,

A follow-up patch.  Will queue in cgroup/for-4.7-fixes.

Thanks.
------ 8< ------
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+
---
 kernel/cgroup.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 789b84f..688eb0c 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++;

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC PATCH] cgroup: remove redundant cleanup in css_create Wenwei Tao <wwtao0320@163.com> - 2016-05-13 17:10 +0200
  [PATCH] cgroup: remove redundant cleanup in css_create Tejun Heo <tj@kernel.org> - 2016-05-26 21:20 +0200
    [PATCH cgroup/for-4.7-fixes] cgroup: set css->id to -1 during init Tejun Heo <tj@kernel.org> - 2016-05-26 21:50 +0200

csiph-web