1 From 695cd416ce6c02d7a20108765573936998b2dbf0 Mon Sep 17 00:00:00 2001
2 From: Marcin Wilk <marcin.wilk@caviumnetworks.com>
3 Date: Tue, 11 Apr 2017 14:35:13 +0200
4 Subject: [PATCH] net/thunderx: fix stats access out of bounds
6 Trying to assign more queues to stats struct break only from one loop
7 when the maximum size is reached. Outside loop iteration is continued.
8 This leads to access an array out of bounds.
10 Fixes: 21e3fb0050b9 ("net/thunderx: add final bits for secondary queue support")
13 Signed-off-by: Marcin Wilk <marcin.wilk@caviumnetworks.com>
14 Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
16 drivers/net/thunderx/nicvf_ethdev.c | 8 ++++----
17 1 file changed, 4 insertions(+), 4 deletions(-)
19 Origin: http://dpdk.org/browse/dpdk/commit/?id=695cd416ce6c02d7a20108765573936998b2dbf0
20 Original-Author: Marcin Wilk <marcin.wilk@caviumnetworks.com>
21 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
22 Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
23 Last-Update: 2017-05-18
25 diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
26 index b0b9c3b..36ff94f 100644
27 --- a/drivers/net/thunderx/nicvf_ethdev.c
28 +++ b/drivers/net/thunderx/nicvf_ethdev.c
29 @@ -258,7 +258,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
31 /* Reading per RX ring stats */
32 for (qidx = rx_start; qidx <= rx_end; qidx++) {
33 - if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS)
34 + if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
37 nicvf_hw_get_rx_qstats(nic, &rx_qstats, qidx);
38 @@ -271,7 +271,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
40 /* Reading per TX ring stats */
41 for (qidx = tx_start; qidx <= tx_end; qidx++) {
42 - if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS)
43 + if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
46 nicvf_hw_get_tx_qstats(nic, &tx_qstats, qidx);
47 @@ -290,7 +290,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
49 /* Reading per RX ring stats */
50 for (qidx = rx_start; qidx <= rx_end; qidx++) {
51 - if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS)
52 + if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
55 nicvf_hw_get_rx_qstats(snic, &rx_qstats,
56 @@ -303,7 +303,7 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
57 nicvf_tx_range(dev, snic, &tx_start, &tx_end);
58 /* Reading per TX ring stats */
59 for (qidx = tx_start; qidx <= tx_end; qidx++) {
60 - if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS)
61 + if (qidx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
64 nicvf_hw_get_tx_qstats(snic, &tx_qstats,