Merge tag 'tty-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
[firefly-linux-kernel-4.4.55.git] / net / sched / cls_flow.c
index 461410394d085917ee8b8039ab5cfd5f5a6cf7c3..a620c4e288a51f55771399f6c1f81328bab9f7c7 100644 (file)
@@ -557,17 +557,21 @@ static int flow_init(struct tcf_proto *tp)
        return 0;
 }
 
-static void flow_destroy(struct tcf_proto *tp)
+static bool flow_destroy(struct tcf_proto *tp, bool force)
 {
        struct flow_head *head = rtnl_dereference(tp->root);
        struct flow_filter *f, *next;
 
+       if (!force && !list_empty(&head->filters))
+               return false;
+
        list_for_each_entry_safe(f, next, &head->filters, list) {
                list_del_rcu(&f->list);
                call_rcu(&f->rcu, flow_destroy_filter);
        }
        RCU_INIT_POINTER(tp->root, NULL);
        kfree_rcu(head, rcu);
+       return true;
 }
 
 static unsigned long flow_get(struct tcf_proto *tp, u32 handle)