alistair23-linux/net/sched
John Fastabend de5df63228 net: sched: cls_u32 changes to knode must appear atomic to readers
Changes to the cls_u32 classifier must appear atomic to the
readers. Before this patch if a change is requested for both
the exts and ifindex, first the ifindex is updated then the
exts with tcf_exts_change(). This opens a small window where
a reader can have a exts chain with an incorrect ifindex. This
violates the the RCU semantics.

Here we resolve this by always passing u32_set_parms() a copy
of the tc_u_knode to work on and then inserting it into the hash
table after the updates have been successfully applied.

Tested with the following short script:

#tc filter add dev p3p2 parent 8001:0 protocol ip prio 99 handle 1: \
	       u32 divisor 256

#tc filter add dev p3p2 parent 8001:0 protocol ip prio 99 \
	       u32 link 1: hashkey mask ffffff00 at 12    \
	       match ip src 192.168.8.0/2

#tc filter add dev p3p2 parent 8001:0 protocol ip prio 102    \
	       handle 1::10 u32 classid 1:2 ht 1: 	      \
	       match ip src 192.168.8.0/8 match ip tos 0x0a 1e

#tc filter change dev p3p2 parent 8001:0 protocol ip prio 102 \
		 handle 1::10 u32 classid 1:2 ht 1:        \
		 match ip src 1.1.0.0/8 match ip tos 0x0b 1e

CC: Eric Dumazet <edumazet@google.com>
CC: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-09-22 15:59:21 -04:00
..
act_api.c net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-04-24 13:44:54 -04:00
act_csum.c net_sched: act: move tcf_hashinfo_init() into tcf_register_action() 2014-02-12 19:23:32 -05:00
act_gact.c net_sched: act: move tcf_hashinfo_init() into tcf_register_action() 2014-02-12 19:23:32 -05:00
act_ipt.c net_sched: act: move tcf_hashinfo_init() into tcf_register_action() 2014-02-12 19:23:32 -05:00
act_mirred.c net_sched: hold tcf_lock in netdevice notifier 2014-07-20 20:31:42 -07:00
act_nat.c net_sched: act: move tcf_hashinfo_init() into tcf_register_action() 2014-02-12 19:23:32 -05:00
act_pedit.c net_sched: act: move tcf_hashinfo_init() into tcf_register_action() 2014-02-12 19:23:32 -05:00
act_police.c net: use ktime_get_ns() and ktime_get_real_ns() helpers 2014-08-22 19:57:23 -07:00
act_simple.c net_sched: act: move tcf_hashinfo_init() into tcf_register_action() 2014-02-12 19:23:32 -05:00
act_skbedit.c net_sched: act: move tcf_hashinfo_init() into tcf_register_action() 2014-02-12 19:23:32 -05:00
cls_api.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
cls_basic.c net: sched: cls_basic use RCU 2014-09-13 12:30:25 -04:00
cls_bpf.c net_sched: fix suspicious RCU usage in cls_bpf_classify() 2014-09-15 17:42:08 -04:00
cls_cgroup.c net: sched: cls_cgroup need tcf_exts_init in all cases 2014-09-16 16:26:39 -04:00
cls_flow.c net: sched: cls_flow use RCU 2014-09-13 12:30:26 -04:00
cls_fw.c net: sched: cls_fw: add missing tcf_exts_init call in fw_change() 2014-09-16 15:59:36 -04:00
cls_route.c net: sched: RCU cls_route 2014-09-13 12:30:26 -04:00
cls_rsvp.c
cls_rsvp.h net: sched: rcu'ify cls_rsvp 2014-09-13 12:30:26 -04:00
cls_rsvp6.c
cls_tcindex.c net_sched: fix a null pointer dereference in tcindex_set_parms() 2014-09-16 15:20:09 -04:00
cls_u32.c net: sched: cls_u32 changes to knode must appear atomic to readers 2014-09-22 15:59:21 -04:00
em_canid.c net: em_canid: remove useless statements from em_canid_change 2014-06-21 15:40:22 -07:00
em_cmp.c
em_ipset.c em_ipset: use dev_net() accessor 2013-10-18 16:23:06 -04:00
em_meta.c net: Change skb_get_rxhash to skb_get_hash 2013-12-17 16:36:21 -05:00
em_nbyte.c
em_text.c
em_u32.c
ematch.c
Kconfig net: pkt_sched: PIE AQM scheme 2014-01-06 15:13:01 -05:00
Makefile net: pkt_sched: PIE AQM scheme 2014-01-06 15:13:01 -05:00
sch_api.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_atm.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_blackhole.c
sch_cbq.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_choke.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_codel.c
sch_drr.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_dsmark.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_fifo.c
sch_fq.c net: use ktime_get_ns() and ktime_get_real_ns() helpers 2014-08-22 19:57:23 -07:00
sch_fq_codel.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_generic.c net: sched: use __skb_queue_head_init() where applicable 2014-09-19 16:32:10 -04:00
sch_gred.c net_sched: replace pr_warning with pr_warn 2013-12-31 13:50:56 -05:00
sch_hfsc.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_hhf.c net: use the new API kvfree() 2014-06-05 00:49:51 -07:00
sch_htb.c net: sched: use __skb_queue_head_init() where applicable 2014-09-19 16:32:10 -04:00
sch_ingress.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_mq.c pkt_sched: give visibility to mq slave qdiscs 2013-12-09 19:54:47 -05:00
sch_mqprio.c net: qdisc: use rcu prefix and silence sparse warnings 2014-09-13 12:30:25 -04:00
sch_multiq.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_netem.c net: use the new API kvfree() 2014-06-05 00:49:51 -07:00
sch_pie.c net: sched: Cleanup PIE comments 2014-02-13 18:29:58 -05:00
sch_plug.c
sch_prio.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_qfq.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_red.c
sch_sfb.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_sfq.c net: rcu-ify tcf_proto 2014-09-13 12:30:25 -04:00
sch_tbf.c net: use ktime_get_ns() and ktime_get_real_ns() helpers 2014-08-22 19:57:23 -07:00
sch_teql.c net: qdisc: use rcu prefix and silence sparse warnings 2014-09-13 12:30:25 -04:00