提交 fae9c791 编写于 作者: L Li Zefan 提交者: Paul E. McKenney

cgroup: Fix an RCU warning in alloc_css_id()

With CONFIG_PROVE_RCU=y, a warning can be triggered:

  # mount -t cgroup -o memory xxx /mnt
  # mkdir /mnt/0

...
kernel/cgroup.c:4442 invoked rcu_dereference_check() without protection!
...

This is a false-positive. It's safe to directly access parent_css->id.
Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
上级 9a9686b6
...@@ -4561,13 +4561,13 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent, ...@@ -4561,13 +4561,13 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent,
{ {
int subsys_id, i, depth = 0; int subsys_id, i, depth = 0;
struct cgroup_subsys_state *parent_css, *child_css; struct cgroup_subsys_state *parent_css, *child_css;
struct css_id *child_id, *parent_id = NULL; struct css_id *child_id, *parent_id;
subsys_id = ss->subsys_id; subsys_id = ss->subsys_id;
parent_css = parent->subsys[subsys_id]; parent_css = parent->subsys[subsys_id];
child_css = child->subsys[subsys_id]; child_css = child->subsys[subsys_id];
depth = css_depth(parent_css) + 1;
parent_id = parent_css->id; parent_id = parent_css->id;
depth = parent_id->depth;
child_id = get_new_cssid(ss, depth); child_id = get_new_cssid(ss, depth);
if (IS_ERR(child_id)) if (IS_ERR(child_id))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册