Skip to contentSkip to conversation

net: sched: cls_cgroup tear down exts and ematch from rcu callback

PATCH In review John Fastabend 2 participants 3 messages Oct 3, 2014 – Oct 6, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sched: cls_cgroup tear down exts and ematch from rcu callback

It is not RCU safe to destroy the action chain while there is a possibility of readers accessing it. Move this code into the rcu callback using the same rcu callback used in the code patch to make a change to head.

---
 net/sched/cls_cgroup.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
net/sched/cls_cgroup.c +1 -3
index d4fef3a..dead710 100644
@@ -156,10 +156,8 @@ static void cls_cgroup_destroy(struct tcf_proto *tp)
 	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
 
 	if (head) {
-		tcf_exts_destroy(&head->exts);
-		tcf_em_tree_destroy(head->net, &head->ematches);
 		RCU_INIT_POINTER(tp->root, NULL);
-		kfree_rcu(head, rcu);
+		call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
 	}
 }
 
maintainer
#1 lore raw

From: John Fastabend <[email protected]>
Date: Fri, 03 Oct 2014 09:33:35 -0700

Quoted 6 lines

It is not RCU safe to destroy the action chain while there is a possibility of readers accessing it. Move this code into the rcu callback using the same rcu callback used in the code patch to make a change to head.

...

net/sched/cls_cgroup.c static void cls_cgroup_destroy(struct tcf_proto *tp) · line 161

Quoted 10 lines
net/sched/cls_cgroup.c +1 -3
@@ -156,10 +156,8 @@ static void cls_cgroup_destroy(struct tcf_proto *tp)
 	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
 
 	if (head) {
-		tcf_exts_destroy(&head->exts);
-		tcf_em_tree_destroy(head->net, &head->ematches);
 		RCU_INIT_POINTER(tp->root, NULL);
-		kfree_rcu(head, rcu);
+		call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
 	}

tcf_em_tree_destroy() takes head->tp as it's first argument in my net-next tree, maybe you need to respin this?

#2 lore raw
Quoted 13 lines · David Miller

From: John Fastabend <[email protected]>
Date: Fri, 03 Oct 2014 09:33:35 -0700

Quoted 6 lines

It is not RCU safe to destroy the action chain while there is a possibility of readers accessing it. Move this code into the rcu callback using the same rcu callback used in the code patch to make a change to head.

...

Quoted 3 lines
net/sched/cls_cgroup.c +0 -0
@@ -156,10 +156,8 @@ static void cls_cgroup_destroy(struct tcf_proto *tp)
  	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
 
Quoted 11 lines

net/sched/cls_cgroup.c static void cls_cgroup_destroy(struct tcf_proto *tp) · line 161

Quoted 7 lines
net/sched/cls_cgroup.c +1 -3
  	if (head) {
-		tcf_exts_destroy(&head->exts);
-		tcf_em_tree_destroy(head->net, &head->ematches);
  		RCU_INIT_POINTER(tp->root, NULL);
-		kfree_rcu(head, rcu);
+		call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
  	}

tcf_em_tree_destroy() takes head->tp as it's first argument in my net-next tree, maybe you need to respin this?

Yep, I'll respin this now sorry about that got a bit out of sync.

Thanks!

Signature · 1 line
John Fastabend         Intel Corporation