[1/2] net/bonding: fix stack overflow in selection logic

Message ID 20190805144454.10496-1-kkanas@marvell.com (mailing list archive)
State Rejected, archived
Delegated to: Ferruh Yigit
Headers
Series [1/2] net/bonding: fix stack overflow in selection logic |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Krzysztof Kanas Aug. 5, 2019, 2:44 p.m. UTC
  From: Krzysztof Kanas <kkanas@marvell.com>

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")
Cc: danielx.t.mrzyglod@intel.com

Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

David Marchand Aug. 5, 2019, 3:09 p.m. UTC | #1
On Mon, Aug 5, 2019 at 4:46 PM <kkanas@marvell.com> wrote:
>
> From: Krzysztof Kanas <kkanas@marvell.com>
>
> Bonding selection logic uses agg_bandwidth, agg_count indexed by port_id
> but those arrays are 8 entries long.

Idem http://mails.dpdk.org/archives/dev/2019-July/140020.html

I did not get a reply from you.
  
Krzysztof Kanas Aug. 7, 2019, 7:41 a.m. UTC | #2
On 19-08-05 17:09, David Marchand wrote:
> External Email
> 
> ----------------------------------------------------------------------
> On Mon, Aug 5, 2019 at 4:46 PM <kkanas@marvell.com> wrote:
> >
> > From: Krzysztof Kanas <kkanas@marvell.com>
> >
> > Bonding selection logic uses agg_bandwidth, agg_count indexed by port_id
> > but those arrays are 8 entries long.
> 
> Idem http://mails.dpdk.org/archives/dev/2019-July/140020.html
> 
> I did not get a reply from you.
> 

Sorry I have look at mailing list and looked that discussion stooped at 
http://mails.dpdk.org/archives/dev/2019-March/127444.html
So I prepared fix for and wanted to reply to that thread with new 
patches.

Unfortunately I added '--reply-to' to git send-email command and not 
--in-reply-to as I should have done.
> 
> -- 
> David Marchand
  
Ferruh Yigit Oct. 8, 2019, 2:33 p.m. UTC | #3
On 8/5/2019 3:44 PM, kkanas@marvell.com wrote:
> From: Krzysztof Kanas <kkanas@marvell.com>
> 
> 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")
> Cc: danielx.t.mrzyglod@intel.com
> 
> Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>

This is duplication of the an existing patch [1] which has been merged now,
rejecting this one.

[1] https://patchwork.dpdk.org/patch/51492/
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index d764dad331ed..89a8ba3de963 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -670,8 +670,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;