linux/net/sched
Jakub Kicinski 25415cec50 cls_bpf: don't decrement net's refcount when offload fails
When cls_bpf offload was added it seemed like a good idea to
call cls_bpf_delete_prog() instead of extending the error
handling path, since the software state is fully initialized
at that point.  This handling of errors without jumping to
the end of the function is error prone, as proven by later
commit missing that extra call to __cls_bpf_delete_prog().

__cls_bpf_delete_prog() is now expected to be invoked with
a reference on exts->net or the field zeroed out.  The call
on the offload's error patch does not fullfil this requirement,
leading to each error stealing a reference on net namespace.

Create a function undoing what cls_bpf_set_parms() did and
use it from __cls_bpf_delete_prog() and the error path.

Fixes: aae2c35ec8 ("cls_bpf: use tcf_exts_get_net() before call_rcu()")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-11-28 15:49:44 -05: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 Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09: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 sched actions: change IFE modules alias names 2017-10-12 22:13:20 -07: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 sched actions: change IFE modules alias names 2017-10-12 22:13:20 -07:00
act_mirred.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09: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 Revert "net_sched: hold netns refcnt for each action" 2017-11-09 10:03:09 +09: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: crash on blocks with goto chain action 2017-11-25 23:57:20 +09: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 cls_bpf: don't decrement net's refcount when offload fails 2017-11-28 15:49:44 -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 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-10 10:00:18 +09:00
em_canid.c net: sched: remove tcf_proto from ematch calls 2014-10-06 18:02:32 -04:00
em_cmp.c
em_ipset.c netfilter: x_tables: move hook state into xt_action_param structure 2016-11-03 10:56:21 +01:00
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 net: sched: remove tcf_proto from ematch calls 2014-10-06 18:02:32 -04:00
em_text.c net: Remove state argument from skb_find_text() 2015-02-22 15:59:54 -05:00
em_u32.c
ematch.c net: sched: ematch: obtain net pointer from blocks 2017-10-16 21:00:40 +01: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
sch_api.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-10-30 21:09:24 +09:00
sch_atm.c net: sched: store Qdisc pointer in struct block 2017-10-16 21:00:40 +01:00
sch_blackhole.c net_sched: drop packets after root qdisc lock is released 2016-06-25 12:19:35 -04:00
sch_cbq.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01: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 treewide: use kv[mz]alloc* rather than opencoded variants 2017-05-08 17:15:13 -07: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 sched: don't use skb queue helpers 2016-09-19 01:47:18 -04:00
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: core: introduce mini_Qdisc and eliminate usage of tp->q for clsact fastpath 2017-11-03 21:57:24 +09:00
sch_gred.c netlink: pass extended ACK struct to parsing functions 2017-04-13 13:58:22 -04: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: core: introduce mini_Qdisc and eliminate usage of tp->q for clsact fastpath 2017-11-03 21:57:24 +09: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 net_sched: drop packets after root qdisc lock is released 2016-06-25 12:19:35 -04:00
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/sch_red.c: work around gcc-4.4.4 anon union initializer issue 2017-11-13 10:33:07 +09:00
sch_sfb.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01:00
sch_sfq.c net: sched: mark expected switch fall-throughs 2017-10-22 02:07:08 +01: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 net: make ndo_get_stats64 a void function 2017-01-08 17:51:44 -05:00