Skip to content

Commit fae9c79

Browse files
Li Zefanpaulmck
authored andcommitted
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: Li Zefan <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 9a9686b commit fae9c79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/cgroup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4561,13 +4561,13 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent,
45614561
{
45624562
int subsys_id, i, depth = 0;
45634563
struct cgroup_subsys_state *parent_css, *child_css;
4564-
struct css_id *child_id, *parent_id = NULL;
4564+
struct css_id *child_id, *parent_id;
45654565

45664566
subsys_id = ss->subsys_id;
45674567
parent_css = parent->subsys[subsys_id];
45684568
child_css = child->subsys[subsys_id];
4569-
depth = css_depth(parent_css) + 1;
45704569
parent_id = parent_css->id;
4570+
depth = parent_id->depth;
45714571

45724572
child_id = get_new_cssid(ss, depth);
45734573
if (IS_ERR(child_id))

0 commit comments

Comments
 (0)