Skip to contentSkip to conversation

net/bonding: fix stack overflow in selection logic

PATCH In review [email protected] 2 participants 2 messages Jul 30, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/bonding: fix stack overflow in selection logic

From: Krzysztof Kanas <[email protected]>

Bonding selection logic uses agg_bandwidth, agg_count indexed by port_id but those arrays are 8 entries long.

Fixes 6d72657ce379 ("net/bonding: add other aggregator modes")
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bonding/rte_eth_bond_8023ad.c +2 -2
index 1e6a3fc7c641..a7c040e26931 100644
@@ -669,8 +669,8 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id)
 	struct port *agg, *port;
 	uint16_t slaves_count, new_agg_id, i, j = 0;
 	uint16_t *slaves;
-	uint64_t agg_bandwidth[8] = {0};
-	uint64_t agg_count[8] = {0};
+	uint64_t agg_bandwidth[RTE_MAX_ETHPORTS] = {0};
+	uint64_t agg_count[RTE_MAX_ETHPORTS] = {0};
 	uint16_t default_slave = 0;
 	uint8_t mode_count_id, mode_band_id;
 	struct rte_eth_link link_info;
Signature · 1 line
2.21.0
#1 lore raw
Quoted 30 lines · On Tue, Jul 30, 2019 at 1:32 PM <[email protected]> wrote:

From: Krzysztof Kanas <[email protected]>

Bonding selection logic uses agg_bandwidth, agg_count indexed by port_id but those arrays are 8 entries long.

Fixes 6d72657ce379 ("net/bonding: add other aggregator modes")
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bonding/rte_eth_bond_8023ad.c +2 -3
index 1e6a3fc7c641..a7c040e26931 100644
@@ -669,8 +669,8 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id)
        struct port *agg, *port;
        uint16_t slaves_count, new_agg_id, i, j = 0;
        uint16_t *slaves;
-       uint64_t agg_bandwidth[8] = {0};
-       uint64_t agg_count[8] = {0};
+       uint64_t agg_bandwidth[RTE_MAX_ETHPORTS] = {0};
+       uint64_t agg_count[RTE_MAX_ETHPORTS] = {0};
        uint16_t default_slave = 0;
        uint8_t mode_count_id, mode_band_id;
        struct rte_eth_link link_info;
--
Quoted 2 lines

2.21.0

I already sent the same patch.
Please see the comments if you want to take over this:
https://patchwork.dpdk.org/patch/51492/

Signature · 1 line
David Marchand