diff options
author | Vlad Buslov <vladbu@mellanox.com> | 2019-02-11 10:55:36 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-12 13:41:32 -0500 |
commit | bbf73830cd48cff1599811d4f69c7cfd49c7b869 (patch) | |
tree | 8d7b223d7f14ebd104a608c2f5e7adb5c307a29a /net/sched/sch_api.c | |
parent | 165f01354c52b6ce175b2c67f771c153f0563f41 (diff) | |
download | linux-bbf73830cd48cff1599811d4f69c7cfd49c7b869.tar.gz linux-bbf73830cd48cff1599811d4f69c7cfd49c7b869.tar.bz2 linux-bbf73830cd48cff1599811d4f69c7cfd49c7b869.zip |
net: sched: traverse chains in block with tcf_get_next_chain()
All users of block->chain_list rely on rtnl lock and assume that no new
chains are added when traversing the list. Use tcf_get_next_chain() to
traverse chain list without relying on rtnl mutex. This function iterates
over chains by taking reference to current iterator chain only and doesn't
assume external synchronization of chain list.
Don't take reference to all chains in block when flushing and use
tcf_get_next_chain() to safely iterate over chain list instead. Remove
tcf_block_put_all_chains() that is no longer used.
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_api.c')
-rw-r--r-- | net/sched/sch_api.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 03e26e8d0ec9..80058abc729f 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1909,7 +1909,9 @@ static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid, block = cops->tcf_block(q, cl, NULL); if (!block) return; - list_for_each_entry(chain, &block->chain_list, list) { + for (chain = tcf_get_next_chain(block, NULL); + chain; + chain = tcf_get_next_chain(block, chain)) { struct tcf_proto *tp; for (tp = rtnl_dereference(chain->filter_chain); |