net: sched: cls_cgroup tear down exts and ematch from rcu callback
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 6 Oct 2014 04:28:20 +0000 (21:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 6 Oct 2014 22:02:32 +0000 (18:02 -0400)
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.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_cgroup.c

index 2f77a89..d61a801 100644 (file)
@@ -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->ematches);
                RCU_INIT_POINTER(tp->root, NULL);
-               kfree_rcu(head, rcu);
+               call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
        }
 }