linux/net/sched
Daniel Borkmann ad9294dbc2 bpf: fix cls_bpf on filter replace
Running the following sequence is currently broken:

  # tc qdisc add dev foo clsact
  # tc filter replace dev foo ingress prio 1 handle 1 bpf da obj bar.o
  # tc filter replace dev foo ingress prio 1 handle 1 bpf da obj bar.o
  RTNETLINK answers: Invalid argument

The normal expectation on kernel side is that the second command
succeeds replacing the existing program. However, what happens is
in cls_bpf_change(), we bail out with err in the second run in
cls_bpf_offload(). The EINVAL comes directly in cls_bpf_offload()
when comparing prog vs oldprog's gen_flags. In case of above
replace the new prog's gen_flags are 0, but the old ones are 8,
which means TCA_CLS_FLAGS_NOT_IN_HW is set (e.g. drivers not having
cls_bpf offload).

Fix 102740bd94 ("cls_bpf: fix offload assumptions after callback
conversion") in the following way: gen_flags from user space passed
down via netlink cannot include status flags like TCA_CLS_FLAGS_IN_HW
or TCA_CLS_FLAGS_NOT_IN_HW as opposed to oldprog that we previously
loaded. Therefore, it doesn't make any sense to include them in the
gen_flags comparison with the new prog before we even attempt to
offload. Thus, lets fix this before 4.15 goes out.

Fixes: 102740bd94 ("cls_bpf: fix offload assumptions after callback conversion")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-01-17 17:14:06 -05:00
..
Kconfig net/sched: Introduce Credit Based Shaper (CBS) qdisc 2017-10-27 09:48:02 -07:00
Makefile Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-04 09:26:51 +09:00
act_api.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
act_bpf.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
act_connmark.c Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09:00
act_csum.c net: accept UFO datagrams from tuntap and packet 2017-11-24 01:37:35 +09:00
act_gact.c net/sched: Fix update of lastuse in act modules implementing stats_update 2018-01-02 13:27:52 -05:00
act_ife.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
act_ipt.c Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09:00
act_meta_mark.c net: remove duplicate includes 2017-12-13 13:18:46 -05:00
act_meta_skbprio.c net sched actions: change IFE modules alias names 2017-10-12 22:13:20 -07:00
act_meta_skbtcindex.c net: remove duplicate includes 2017-12-13 13:18:46 -05:00
act_mirred.c net/sched: Fix update of lastuse in act modules implementing stats_update 2018-01-02 13:27:52 -05:00
act_nat.c Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09:00
act_pedit.c Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09:00
act_police.c Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09:00
act_sample.c act_sample: get rid of tcf_sample_cleanup_rcu() 2017-11-30 10:19:17 -05:00
act_simple.c Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09:00
act_skbedit.c Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09:00
act_skbmod.c Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09:00
act_tunnel_key.c Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09:00
act_vlan.c act_vlan: VLAN action rewrite to use RCU lock/unlock and update 2017-11-10 15:32:20 +09:00
cls_api.c net: sched: fix possible null pointer deref in tcf_block_put 2017-12-26 13:02:05 -05:00
cls_basic.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
cls_bpf.c bpf: fix cls_bpf on filter replace 2018-01-17 17:14:06 -05:00
cls_cgroup.c cls_cgroup: use tcf_exts_get_net() before call_rcu() 2017-11-09 10:03:09 +09:00
cls_flow.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
cls_flower.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
cls_fw.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
cls_matchall.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
cls_route.c cls_route: use tcf_exts_get_net() before call_rcu() 2017-11-09 10:03:10 +09:00
cls_rsvp.c
cls_rsvp.h cls_rsvp: use tcf_exts_get_net() before call_rcu() 2017-11-09 10:03:10 +09:00
cls_rsvp6.c
cls_tcindex.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
cls_u32.c net: remove duplicate includes 2017-12-13 13:18:46 -05:00
em_canid.c
em_cmp.c
em_ipset.c
em_meta.c net: convert sock.sk_refcnt from atomic_t to refcount_t 2017-07-01 07:39:08 -07:00
em_nbyte.c
em_text.c
em_u32.c
ematch.c net: sched: ematch: obtain net pointer from blocks 2017-10-16 21:00:40 +01:00
sch_api.c net, sched: fix panic when updating miniq {b,q}stats 2018-01-16 15:02:36 -05:00
sch_atm.c net: sched: store Qdisc pointer in struct block 2017-10-16 21:00:40 +01:00
sch_blackhole.c
sch_cbq.c net: sched: cbq: create block for q->link.block 2017-11-28 16:04:26 -05:00
sch_cbs.c net_sch: cbs: Change TC_SETUP_CBS to TC_SETUP_QDISC_CBS 2017-11-08 12:23:38 +09:00
sch_choke.c net_sched: red: Avoid illegal values 2017-12-05 14:37:13 -05:00
sch_codel.c netlink: pass extended ACK struct to parsing functions 2017-04-13 13:58:22 -04:00
sch_drr.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01:00
sch_dsmark.c net: sched: store Qdisc pointer in struct block 2017-10-16 21:00:40 +01:00
sch_fifo.c
sch_fq.c mm, tree wide: replace __GFP_REPEAT by __GFP_RETRY_MAYFAIL with more useful semantic 2017-07-12 16:26:03 -07:00
sch_fq_codel.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01:00
sch_generic.c net, sched: fix panic when updating miniq {b,q}stats 2018-01-16 15:02:36 -05:00
sch_gred.c net_sched: red: Avoid illegal values 2017-12-05 14:37:13 -05:00
sch_hfsc.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01:00
sch_hhf.c sch_hhf: fix null pointer dereference on init failure 2017-08-30 15:26:11 -07:00
sch_htb.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01:00
sch_ingress.c net, sched: fix panic when updating miniq {b,q}stats 2018-01-16 15:02:36 -05:00
sch_mq.c net/sched: Change behavior of mq select_queue() 2017-10-27 09:41:45 -07:00
sch_mqprio.c net_sch: mqprio: Change TC_SETUP_MQPRIO to TC_SETUP_QDISC_MQPRIO 2017-11-08 12:23:38 +09:00
sch_multiq.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01:00
sch_netem.c netem: remove unnecessary 64 bit modulus 2017-11-15 14:14:16 +09:00
sch_pie.c net: sched: Convert timers to use timer_setup() 2017-10-18 12:39:54 +01:00
sch_plug.c
sch_prio.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01:00
sch_qfq.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01:00
sch_red.c net: sched: Move to new offload indication in RED 2017-12-15 13:35:36 -05:00
sch_sfb.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01:00
sch_sfq.c net_sched: red: Avoid illegal values 2017-12-05 14:37:13 -05:00
sch_tbf.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-09-01 17:42:05 -07:00
sch_teql.c