• John Hurley's avatar
    net: sched: prevent duplicate flower rules from tcf_proto destroy race · 59eb87cb
    John Hurley authored
    When a new filter is added to cls_api, the function
    tcf_chain_tp_insert_unique() looks up the protocol/priority/chain to
    determine if the tcf_proto is duplicated in the chain's hashtable. It then
    creates a new entry or continues with an existing one. In cls_flower, this
    allows the function fl_ht_insert_unque to determine if a filter is a
    duplicate and reject appropriately, meaning that the duplicate will not be
    passed to drivers via the offload hooks. However, when a tcf_proto is
    destroyed it is removed from its chain before a hardware remove hook is
    hit. This can lead to a race whereby the driver has not received the
    remove message but duplicate flows can be accepted. This, in turn, can
    lead to the offload driver receiving incorrect duplicate flows and out of
    order add/delete messages.
    
    Prevent duplicates by utilising an approach suggested by Vlad Buslov. A
    hash table per block stores each unique chain/protocol/prio being
    destroyed. This entry is only removed when the full destroy (and hardware
    offload) has completed. If a new flow is being added with the same
    identiers as a tc_proto being detroyed, then the add request is replayed
    until the destroy is complete.
    
    Fixes: 8b64678e ("net: sched: refactor tp insert/delete for concurrent execution")
    Signed-off-by: default avatarJohn Hurley <john.hurley@netronome.com>
    Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
    Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
    Reported-by: default avatarLouis Peens <louis.peens@netronome.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    59eb87cb
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
act_api.c Loading commit data...
act_bpf.c Loading commit data...
act_connmark.c Loading commit data...
act_csum.c Loading commit data...
act_ct.c Loading commit data...
act_ctinfo.c Loading commit data...
act_gact.c Loading commit data...
act_ife.c Loading commit data...
act_ipt.c Loading commit data...
act_meta_mark.c Loading commit data...
act_meta_skbprio.c Loading commit data...
act_meta_skbtcindex.c Loading commit data...
act_mirred.c Loading commit data...
act_mpls.c Loading commit data...
act_nat.c Loading commit data...
act_pedit.c Loading commit data...
act_police.c Loading commit data...
act_sample.c Loading commit data...
act_simple.c Loading commit data...
act_skbedit.c Loading commit data...
act_skbmod.c Loading commit data...
act_tunnel_key.c Loading commit data...
act_vlan.c Loading commit data...
cls_api.c Loading commit data...
cls_basic.c Loading commit data...
cls_bpf.c Loading commit data...
cls_cgroup.c Loading commit data...
cls_flow.c Loading commit data...
cls_flower.c Loading commit data...
cls_fw.c Loading commit data...
cls_matchall.c Loading commit data...
cls_route.c Loading commit data...
cls_rsvp.c Loading commit data...
cls_rsvp.h Loading commit data...
cls_rsvp6.c Loading commit data...
cls_tcindex.c Loading commit data...
cls_u32.c Loading commit data...
em_canid.c Loading commit data...
em_cmp.c Loading commit data...
em_ipset.c Loading commit data...
em_ipt.c Loading commit data...
em_meta.c Loading commit data...
em_nbyte.c Loading commit data...
em_text.c Loading commit data...
em_u32.c Loading commit data...
ematch.c Loading commit data...
sch_api.c Loading commit data...
sch_atm.c Loading commit data...
sch_blackhole.c Loading commit data...
sch_cake.c Loading commit data...
sch_cbq.c Loading commit data...
sch_cbs.c Loading commit data...
sch_choke.c Loading commit data...
sch_codel.c Loading commit data...
sch_drr.c Loading commit data...
sch_dsmark.c Loading commit data...
sch_etf.c Loading commit data...
sch_fifo.c Loading commit data...
sch_fq.c Loading commit data...
sch_fq_codel.c Loading commit data...
sch_generic.c Loading commit data...
sch_gred.c Loading commit data...
sch_hfsc.c Loading commit data...
sch_hhf.c Loading commit data...
sch_htb.c Loading commit data...
sch_ingress.c Loading commit data...
sch_mq.c Loading commit data...
sch_mqprio.c Loading commit data...
sch_multiq.c Loading commit data...
sch_netem.c Loading commit data...
sch_pie.c Loading commit data...
sch_plug.c Loading commit data...
sch_prio.c Loading commit data...
sch_qfq.c Loading commit data...
sch_red.c Loading commit data...
sch_sfb.c Loading commit data...
sch_sfq.c Loading commit data...
sch_skbprio.c Loading commit data...
sch_taprio.c Loading commit data...
sch_tbf.c Loading commit data...
sch_teql.c Loading commit data...