net/bonding:fix balance-xor link down stack overflow

Message ID 20210810064323.4161835-1-jilei8@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/bonding:fix balance-xor link down stack overflow |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/github-robot-build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-x86_64-compile-testing success Testing PASS
ci/intel-Testing success Testing PASS

Commit Message

jilei Aug. 10, 2021, 6:43 a.m. UTC
  When slave link down, deactivate_slave will internals->active_slaves
and internals->active_slave_count.Active_slave in bond_ethdev_rx_burst
may out of range in internals->active_slaves.It will get bond's port_id
cause stack overflow

Cc: stable@dpdk.org
Signed-off-by: jilei <jilei8@huawei.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit May 20, 2022, 3:33 p.m. UTC | #1
On 8/10/2021 8:50 AM, Min Hu (Connor) wrote:

> 在 2021/8/10 14:43, jilei 写道:
>> When slave link down, deactivate_slave will internals->active_slaves
>> and internals->active_slave_count.Active_slave in bond_ethdev_rx_burst
>> may out of range in internals->active_slaves.It will get bond's port_id
>> cause stack overflow
>>
>> Cc: stable@dpdk.org
>> Signed-off-by: jilei <jilei8@huawei.com>
>> ---
>>   drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
>> b/drivers/net/bonding/rte_eth_bond_pmd.c
>> index a6755661c4..46f2c42d60 100644
>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>> @@ -82,7 +82,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf 
>> **bufs, uint16_t nb_pkts)
>>                        bufs + num_rx_total, nb_pkts);
>>           num_rx_total += num_rx_slave;
>>           nb_pkts -= num_rx_slave;
>> -        if (++active_slave == slave_count)
>> +        if (++active_slave >= slave_count)
>>               active_slave = 0;
>>       }
>>
 >
 > Hi,
 >      Your patch is OK, but the description is misleading and has
 > syntax errors. Please fix it ,thanks.
 >

Hi jilei,

The patch is waiting for a minor update from you, can you please send a 
new version with the requested change?

Btw, please add your sign off in following format:
Signed-off-by: Name Surname <email@address>

Thanks,
ferruh
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index a6755661c4..46f2c42d60 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -82,7 +82,7 @@  bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 					 bufs + num_rx_total, nb_pkts);
 		num_rx_total += num_rx_slave;
 		nb_pkts -= num_rx_slave;
-		if (++active_slave == slave_count)
+		if (++active_slave >= slave_count)
 			active_slave = 0;
 	}