aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net/sched/cls_basic.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-04-21 13:58:16 -0400
committerDavid S. Miller <davem@davemloft.net>2017-04-21 13:58:16 -0400
commitdfb05553a55d89e6daae9cb9abfdf4751e14d72d (patch)
tree4b6135513c77437534060999f462638e4766beb3 /net/sched/cls_basic.c
parentbpf: add napi_id read access to __sk_buff (diff)
parentnet_sched: remove useless NULL to tp->root (diff)
downloadwireguard-linux-dfb05553a55d89e6daae9cb9abfdf4751e14d72d.tar.xz
wireguard-linux-dfb05553a55d89e6daae9cb9abfdf4751e14d72d.zip
Merge branch 'tc-filter-cleanup-destroy-delete'
Cong Wang says: ==================== net_sched: clean up tc filter destroy and delete logic The first patch fixes a potenial race condition, the second one is pure cleanup. ==================== Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_basic.c')
-rw-r--r--net/sched/cls_basic.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 422414f16b38..c4fd63a068f9 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -93,30 +93,28 @@ static void basic_delete_filter(struct rcu_head *head)
kfree(f);
}
-static bool basic_destroy(struct tcf_proto *tp, bool force)
+static void basic_destroy(struct tcf_proto *tp)
{
struct basic_head *head = rtnl_dereference(tp->root);
struct basic_filter *f, *n;
- if (!force && !list_empty(&head->flist))
- return false;
-
list_for_each_entry_safe(f, n, &head->flist, link) {
list_del_rcu(&f->link);
tcf_unbind_filter(tp, &f->res);
call_rcu(&f->rcu, basic_delete_filter);
}
kfree_rcu(head, rcu);
- return true;
}
-static int basic_delete(struct tcf_proto *tp, unsigned long arg)
+static int basic_delete(struct tcf_proto *tp, unsigned long arg, bool *last)
{
+ struct basic_head *head = rtnl_dereference(tp->root);
struct basic_filter *f = (struct basic_filter *) arg;
list_del_rcu(&f->link);
tcf_unbind_filter(tp, &f->res);
call_rcu(&f->rcu, basic_delete_filter);
+ *last = list_empty(&head->flist);
return 0;
}