diff options
author | David S. Miller <davem@davemloft.net> | 2017-04-21 20:58:16 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-21 20:58:16 +0300 |
commit | dfb05553a55d89e6daae9cb9abfdf4751e14d72d (patch) | |
tree | 4b6135513c77437534060999f462638e4766beb3 /net/sched/cls_flow.c | |
parent | b1d9fc41aab11f9520b2e0d57ae872e2ec5d6f32 (diff) | |
parent | 4392053879717edb0c4756a3878c0274267e237b (diff) | |
download | linux-dfb05553a55d89e6daae9cb9abfdf4751e14d72d.tar.xz |
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_flow.c')
-rw-r--r-- | net/sched/cls_flow.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 008ba7e63b7a..3065752b9cda 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c @@ -562,12 +562,14 @@ err1: return err; } -static int flow_delete(struct tcf_proto *tp, unsigned long arg) +static int flow_delete(struct tcf_proto *tp, unsigned long arg, bool *last) { + struct flow_head *head = rtnl_dereference(tp->root); struct flow_filter *f = (struct flow_filter *)arg; list_del_rcu(&f->list); call_rcu(&f->rcu, flow_destroy_filter); + *last = list_empty(&head->filters); return 0; } @@ -583,20 +585,16 @@ static int flow_init(struct tcf_proto *tp) return 0; } -static bool flow_destroy(struct tcf_proto *tp, bool force) +static void flow_destroy(struct tcf_proto *tp) { 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); } kfree_rcu(head, rcu); - return true; } static unsigned long flow_get(struct tcf_proto *tp, u32 handle) |