linux-stable/net/sched
Craig Dillabaugh 734549eb55 net sched actions: fix dumping which requires several messages to user space
Fixes a bug in the tcf_dump_walker function that can cause some actions
to not be reported when dumping a large number of actions. This issue
became more aggrevated when cookies feature was added. In particular
this issue is manifest when large cookie values are assigned to the
actions and when enough actions are created that the resulting table
must be dumped in multiple batches.

The number of actions returned in each batch is limited by the total
number of actions and the memory buffer size.  With small cookies
the numeric limit is reached before the buffer size limit, which avoids
the code path triggering this bug. When large cookies are used buffer
fills before the numeric limit, and the erroneous code path is hit.

For example after creating 32 csum actions with the cookie
aaaabbbbccccdddd

$ tc actions ls action csum
total acts 26

    action order 0: csum (tcp) action continue
    index 1 ref 1 bind 0
    cookie aaaabbbbccccdddd

    .....

    action order 25: csum (tcp) action continue
    index 26 ref 1 bind 0
    cookie aaaabbbbccccdddd
total acts 6

    action order 0: csum (tcp) action continue
    index 28 ref 1 bind 0
    cookie aaaabbbbccccdddd

    ......

    action order 5: csum (tcp) action continue
    index 32 ref 1 bind 0
    cookie aaaabbbbccccdddd

Note that the action with index 27 is omitted from the report.

Fixes: 4b3550ef53 ("[NET_SCHED]: Use nla_nest_start/nla_nest_end")"
Signed-off-by: Craig Dillabaugh <cdillaba@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-03-27 10:59:12 -04:00
..
act_api.c net sched actions: fix dumping which requires several messages to user space 2018-03-27 10:59:12 -04:00
act_bpf.c net/sched: fix idr leak on the error path of tcf_bpf_init() 2018-03-21 18:11:46 -04:00
act_connmark.c net_sched: switch to exit_batch for action pernet ops 2017-12-13 13:58:41 -05:00
act_csum.c net/sched: fix NULL dereference in the error path of tcf_csum_init() 2018-03-17 19:53:28 -04:00
act_gact.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-01-09 10:37:00 -05:00
act_ife.c net_sched: switch to exit_batch for action pernet ops 2017-12-13 13:58:41 -05:00
act_ipt.c net/sched: fix idr leak in the error path of __tcf_ipt_init() 2018-03-21 18:12:16 -04: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 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-01-09 10:37:00 -05:00
act_nat.c net_sched: switch to exit_batch for action pernet ops 2017-12-13 13:58:41 -05:00
act_pedit.c net/sched: fix idr leak in the error path of tcp_pedit_init() 2018-03-21 18:12:08 -04:00
act_police.c net/sched: fix idr leak in the error path of tcf_act_police_init() 2018-03-21 18:12:00 -04:00
act_sample.c net/sched: fix NULL dereference in the error path of tcf_sample_init() 2018-03-17 19:53:28 -04:00
act_simple.c net/sched: fix idr leak in the error path of tcf_simp_init() 2018-03-21 18:11:53 -04:00
act_skbedit.c net_sched: switch to exit_batch for action pernet ops 2017-12-13 13:58:41 -05:00
act_skbmod.c net/sched: fix idr leak in the error path of tcf_skbmod_init() 2018-03-21 18:12:37 -04:00
act_tunnel_key.c net/sched: fix NULL dereference in the error path of tunnel_key_init() 2018-03-17 19:53:28 -04:00
act_vlan.c net/sched: fix idr leak in the error path of tcf_vlan_init() 2018-03-21 18:12:27 -04:00
cls_api.c net: sched: report if filter is too large to dump 2018-02-20 21:57:17 -05:00
cls_basic.c cls_basic: Convert to use idr_alloc_u32 2018-02-06 16:41:26 -05:00
cls_bpf.c cls_bpf: Convert to use idr_alloc_u32 2018-02-06 16:41:26 -05:00
cls_cgroup.c net: sched: propagate extack to cls->destroy callbacks 2018-01-24 16:01:09 -05:00
cls_flow.c net: sched: propagate extack to cls->destroy callbacks 2018-01-24 16:01:09 -05:00
cls_flower.c cls_flower: Convert to idr_alloc_u32 2018-02-06 16:41:26 -05:00
cls_fw.c net: sched: propagate extack to cls->destroy callbacks 2018-01-24 16:01:09 -05:00
cls_matchall.c cls_matchall: propagate extack to delete callback 2018-01-24 16:01:10 -05:00
cls_route.c net: sched: propagate extack to cls->destroy callbacks 2018-01-24 16:01:09 -05:00
cls_rsvp.c
cls_rsvp.h net: sched: propagate extack to cls->destroy callbacks 2018-01-24 16:01:09 -05:00
cls_rsvp6.c
cls_tcindex.c net: sched: propagate extack to cls->destroy callbacks 2018-01-24 16:01:09 -05:00
cls_u32.c net: sched: fix tc_u_common lookup 2018-02-13 12:29:02 -05:00
em_canid.c
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: em_nbyte: don't add the data offset twice 2018-01-24 14:52:40 -05:00
em_text.c
em_u32.c
ematch.c net: sched: ematch: obtain net pointer from blocks 2017-10-16 21:00:40 +01:00
Kconfig net/sched: kconfig: Remove blank help texts 2018-01-31 10:26:30 -05: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 net: sched: introduce ingress/egress block index attributes for qdisc 2018-01-17 14:53:57 -05:00
sch_atm.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05: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: sch: sch_cbq: add extack support 2017-12-21 12:32:51 -05:00
sch_cbs.c net: sch: sch_cbs: add extack support 2017-12-21 12:32:51 -05:00
sch_choke.c net: sched: sch: add extack for change qdisc ops 2017-12-21 12:32:50 -05:00
sch_codel.c net: sched: sch: add extack for change qdisc ops 2017-12-21 12:32:50 -05:00
sch_drr.c net: sch: sch_drr: add extack support 2017-12-21 12:32:51 -05:00
sch_dsmark.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05:00
sch_fifo.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05:00
sch_fq.c net: sched: sch: add extack for change qdisc ops 2017-12-21 12:32:50 -05:00
sch_fq_codel.c net: sch: api: add extack support in tcf_block_get 2017-12-21 12:32:51 -05:00
sch_generic.c net: sched, fix OOO packets with pfifo_fast 2018-03-26 12:36:23 -04:00
sch_gred.c net: sched: sch: add extack for change qdisc ops 2017-12-21 12:32:50 -05:00
sch_hfsc.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05:00
sch_hhf.c net: sched: sch: add extack for change qdisc ops 2017-12-21 12:32:50 -05:00
sch_htb.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05:00
sch_ingress.c net: sched: allow ingress and clsact qdiscs to share filter blocks 2018-01-17 14:53:57 -05:00
sch_mq.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05:00
sch_mqprio.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05:00
sch_multiq.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05:00
sch_netem.c sch_netem: fix skb leak in netem_enqueue() 2018-03-07 11:18:14 -05:00
sch_pie.c net: sched: sch: add extack for change qdisc ops 2017-12-21 12:32:50 -05:00
sch_plug.c net: sched: sch: add extack for change qdisc ops 2017-12-21 12:32:50 -05:00
sch_prio.c net/sched/sch_prio.c: work around gcc-4.4.4 union initializer issues 2018-01-18 21:11:31 -05:00
sch_qfq.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05:00
sch_red.c net: sched: red: don't reset the backlog on every stat dump 2018-01-17 14:29:32 -05:00
sch_sfb.c net: sch: api: add extack support in qdisc_create_dflt 2017-12-21 12:32:51 -05:00
sch_sfq.c net: sch: api: add extack support in tcf_block_get 2017-12-21 12:32:51 -05:00
sch_tbf.c net: sched: tbf: handle GSO_BY_FRAGS case in enqueue 2018-03-04 17:49:17 -05:00
sch_teql.c net: sched: sch: add extack for init callback 2017-12-21 12:32:50 -05:00