diff options
author | 2017-04-21 13:58:16 -0400 | |
---|---|---|
committer | 2017-04-21 13:58:16 -0400 | |
commit | dfb05553a55d89e6daae9cb9abfdf4751e14d72d (patch) | |
tree | 4b6135513c77437534060999f462638e4766beb3 /net/sched/cls_basic.c | |
parent | bpf: add napi_id read access to __sk_buff (diff) | |
parent | net_sched: remove useless NULL to tp->root (diff) | |
download | wireguard-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.c | 10 |
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; } |