linux/net/sched
Vlad Buslov 1f17f7742e net: sched: flower: insert filter to ht before offloading it to hw
John reports:

Recent refactoring of fl_change aims to use the classifier spinlock to
avoid the need for rtnl lock. In doing so, the fl_hw_replace_filer()
function was moved to before the lock is taken. This can create problems
for drivers if duplicate filters are created (commmon in ovs tc offload
due to filters being triggered by user-space matches).

Drivers registered for such filters will now receive multiple copies of
the same rule, each with a different cookie value. This means that the
drivers would need to do a full match field lookup to determine
duplicates, repeating work that will happen in flower __fl_lookup().
Currently, drivers do not expect to receive duplicate filters.

To fix this, verify that filter with same key is not present in flower
classifier hash table and insert the new filter to the flower hash table
before offloading it to hardware. Implement helper function
fl_ht_insert_unique() to atomically verify/insert a filter.

This change makes filter visible to fast path at the beginning of
fl_change() function, which means it can no longer be freed directly in
case of error. Refactor fl_change() error handling code to deallocate the
filter with rcu timeout.

Fixes: 620da48608 ("net: sched: flower: refactor fl_change")
Reported-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-07 19:33:07 -07:00
..
Kconfig net: sched: Kconfig: update reference link for PIE 2019-03-26 11:17:09 -07:00
Makefile tc: Add support for configuring the taprio scheduler 2018-10-04 13:52:23 -07:00
act_api.c net/sched: let actions use RCU to access 'goto_chain' 2019-03-21 13:26:42 -07:00
act_bpf.c net/sched: act_bpf: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_connmark.c net/sched: act_connmark: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_csum.c net/sched: act_csum: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_gact.c net/sched: act_gact: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_ife.c net/sched: act_ife: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_ipt.c net/sched: prepare TC actions to properly validate the control action 2019-03-21 13:26:41 -07:00
act_meta_mark.c
act_meta_skbprio.c
act_meta_skbtcindex.c
act_mirred.c net: sched: fix cleanup NULL pointer exception in act_mirr 2019-03-23 21:36:04 -04:00
act_nat.c net/sched: act_nat: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_pedit.c net/sched: act_pedit: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_police.c net/sched: act_police: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_sample.c net/sched: act_sample: fix divide by zero in the traffic path 2019-04-04 10:46:33 -07:00
act_simple.c net/sched: act_simple: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_skbedit.c net/sched: act_skbedit: validate the control action inside init() 2019-03-21 13:26:41 -07:00
act_skbmod.c net/sched: act_skbmod: validate the control action inside init() 2019-03-21 13:26:42 -07:00
act_tunnel_key.c net/sched: act_tunnel_key: validate the control action inside init() 2019-03-21 13:26:42 -07:00
act_vlan.c net/sched: act_vlan: validate the control action inside init() 2019-03-21 13:26:42 -07:00
cls_api.c net: sched: don't set tunnel for decap action 2019-04-02 13:20:30 -07:00
cls_basic.c net_sched: initialize net pointer inside tcf_exts_init() 2019-02-22 15:26:51 -08:00
cls_bpf.c net_sched: initialize net pointer inside tcf_exts_init() 2019-02-22 15:26:51 -08:00
cls_cgroup.c net_sched: initialize net pointer inside tcf_exts_init() 2019-02-22 15:26:51 -08:00
cls_flow.c net_sched: initialize net pointer inside tcf_exts_init() 2019-02-22 15:26:51 -08:00
cls_flower.c net: sched: flower: insert filter to ht before offloading it to hw 2019-04-07 19:33:07 -07:00
cls_fw.c Revert "net: sched: fw: don't set arg->stop in fw_walk() when empty" 2019-02-27 10:12:19 -08:00
cls_matchall.c net/sched: fix ->get helper of the matchall cls 2019-04-01 14:13:25 -07:00
cls_route.c net_sched: initialize net pointer inside tcf_exts_init() 2019-02-22 15:26:51 -08:00
cls_rsvp.c
cls_rsvp.h net_sched: initialize net pointer inside tcf_exts_init() 2019-02-22 15:26:51 -08:00
cls_rsvp6.c
cls_tcindex.c net_sched: initialize net pointer inside tcf_exts_init() 2019-02-22 15:26:51 -08:00
cls_u32.c net_sched: initialize net pointer inside tcf_exts_init() 2019-02-22 15:26:51 -08:00
em_canid.c
em_cmp.c
em_ipset.c
em_ipt.c
em_meta.c
em_nbyte.c
em_text.c
em_u32.c
ematch.c
sch_api.c net_sched: return correct value for *notify* functions 2019-03-13 13:48:27 -07:00
sch_atm.c net: sched: rename qdisc_destroy() to qdisc_put() 2018-09-25 20:17:35 -07:00
sch_blackhole.c
sch_cake.c sch_cake: Make sure we can write the IP header before changing DSCP bits 2019-04-04 10:55:59 -07:00
sch_cbq.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_cbs.c sched: Avoid dereferencing skb pointer after child enqueue 2019-01-15 20:12:00 -08:00
sch_choke.c
sch_codel.c
sch_drr.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_dsmark.c sched: Avoid dereferencing skb pointer after child enqueue 2019-01-15 20:12:00 -08:00
sch_etf.c etf: Drop all expired packets 2018-11-16 20:39:34 -08:00
sch_fifo.c net: sched: rename qdisc_destroy() to qdisc_put() 2018-09-25 20:17:35 -07:00
sch_fq.c net_sched: sch_fq: avoid calling ktime_get_ns() if not needed 2018-11-20 09:51:32 -08:00
sch_fq_codel.c
sch_generic.c net: sched: add empty status flag for NOLOCK qdisc 2019-03-23 21:52:36 -04:00
sch_gred.c net: sched: gred: support reporting stats from offloads 2018-11-19 18:53:46 -08:00
sch_hfsc.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_hhf.c
sch_htb.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_ingress.c
sch_mq.c net: sched: introduce and use qstats read helpers 2019-04-01 14:50:13 -07:00
sch_mqprio.c net: sched: introduce and use qstats read helpers 2019-04-01 14:50:13 -07:00
sch_multiq.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_netem.c net: netem: fix skb length BUG_ON in __skb_to_sgvec 2019-02-28 10:31:31 -08:00
sch_pie.c net: sched: pie: avoid slow division in drop probability decay 2019-02-28 10:35:41 -08:00
sch_plug.c
sch_prio.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_qfq.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_red.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_sfb.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_sfq.c
sch_skbprio.c
sch_taprio.c net: sched: introduce and use qstats read helpers 2019-04-01 14:50:13 -07:00
sch_tbf.c net: sched: introduce and use qdisc tree flush/purge helpers 2019-04-01 14:50:13 -07:00
sch_teql.c