patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/bonding:fix balance-xor link down stack overflow
@ 2021-08-10  6:43 jilei
  2021-08-10  7:50 ` Min Hu (Connor)
  2022-07-18 13:08 ` [dpdk-dev] [PATCH] net/bonding: fix array overflow in Rx burst Yunjian Wang
  0 siblings, 2 replies; 6+ messages in thread
From: jilei @ 2021-08-10  6:43 UTC (permalink / raw)
  To: dev
  Cc: chas3, humin29, zhaohui8, yu.yutao, hejiajun, liucheng11,
	yinpeijun, jilei, stable

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;
 	}
 
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-stable] [PATCH] net/bonding:fix balance-xor link down stack overflow
  2021-08-10  6:43 [dpdk-stable] [PATCH] net/bonding:fix balance-xor link down stack overflow jilei
@ 2021-08-10  7:50 ` Min Hu (Connor)
  2022-05-20 15:33   ` [dpdk-dev] " Ferruh Yigit
  2022-07-18 13:08 ` [dpdk-dev] [PATCH] net/bonding: fix array overflow in Rx burst Yunjian Wang
  1 sibling, 1 reply; 6+ messages in thread
From: Min Hu (Connor) @ 2021-08-10  7:50 UTC (permalink / raw)
  To: jilei, dev
  Cc: chas3, zhaohui8, yu.yutao, hejiajun, liucheng11, yinpeijun, stable

Hi,
	Your patch is OK, but the description is misleading and has
syntax errors. Please fix it ,thanks.

在 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;
>   	}
>   
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] net/bonding:fix balance-xor link down stack overflow
  2021-08-10  7:50 ` Min Hu (Connor)
@ 2022-05-20 15:33   ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2022-05-20 15:33 UTC (permalink / raw)
  To: Min Hu (Connor), jilei, dev
  Cc: chas3, zhaohui8, yu.yutao, hejiajun, liucheng11, yinpeijun, stable

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH] net/bonding: fix array overflow in Rx burst
  2021-08-10  6:43 [dpdk-stable] [PATCH] net/bonding:fix balance-xor link down stack overflow jilei
  2021-08-10  7:50 ` Min Hu (Connor)
@ 2022-07-18 13:08 ` Yunjian Wang
  2022-07-20  1:28   ` 答复: " humin (Q)
  1 sibling, 1 reply; 6+ messages in thread
From: Yunjian Wang @ 2022-07-18 13:08 UTC (permalink / raw)
  To: dev; +Cc: chas3, humin29, huangshaozhang, jilei8, Yunjian Wang, stable

In bond_ethdev_rx_burst() function, we check the validity of the
'active_slave' as this code:
if (++active_slave == slave_count)
	active_slave = 0;
However, the value of 'active_slave' maybe equal to 'slave_count',
when a slave is down. This is wrong and it can cause buffer overflow.
This patch fixes the issue by using '>=' instead of '=='.

Fixes: e1110e977648 ("net/bonding: fix Rx slave fairness")
Cc: stable@dpdk.org

Signed-off-by: Lei Ji <jilei8@huawei.com>
Signed-off-by: Yunjian Wang <wangyunjian@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 73e6972035..6f8a6da108 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;
 	}
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* 答复: [dpdk-dev] [PATCH] net/bonding: fix array overflow in Rx burst
  2022-07-18 13:08 ` [dpdk-dev] [PATCH] net/bonding: fix array overflow in Rx burst Yunjian Wang
@ 2022-07-20  1:28   ` humin (Q)
  2022-08-25 16:39     ` Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: humin (Q) @ 2022-07-20  1:28 UTC (permalink / raw)
  To: wangyunjian, dev; +Cc: chas3, Huangshaozhang, jilei (F), stable

Acked-by: Min Hu (Connor) <humin29@huawei.com>

-----邮件原件-----
发件人: wangyunjian <wangyunjian@huawei.com> 
发送时间: 2022年7月18日 21:09
收件人: dev@dpdk.org
抄送: chas3@att.com; humin (Q) <humin29@huawei.com>; Huangshaozhang <huangshaozhang@huawei.com>; jilei (F) <jilei8@huawei.com>; wangyunjian <wangyunjian@huawei.com>; stable@dpdk.org
主题: [dpdk-dev] [PATCH] net/bonding: fix array overflow in Rx burst

In bond_ethdev_rx_burst() function, we check the validity of the 'active_slave' as this code:
if (++active_slave == slave_count)
	active_slave = 0;
However, the value of 'active_slave' maybe equal to 'slave_count', when a slave is down. This is wrong and it can cause buffer overflow.
This patch fixes the issue by using '>=' instead of '=='.

Fixes: e1110e977648 ("net/bonding: fix Rx slave fairness")
Cc: stable@dpdk.org

Signed-off-by: Lei Ji <jilei8@huawei.com>
Signed-off-by: Yunjian Wang <wangyunjian@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 73e6972035..6f8a6da108 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;
 	}
 
--
2.27.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 答复: [dpdk-dev] [PATCH] net/bonding: fix array overflow in Rx burst
  2022-07-20  1:28   ` 答复: " humin (Q)
@ 2022-08-25 16:39     ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2022-08-25 16:39 UTC (permalink / raw)
  To: humin (Q), wangyunjian, dev; +Cc: chas3, Huangshaozhang, jilei (F), stable

On 7/20/2022 2:28 AM, humin (Q) wrote:

> -----邮件原件-----
> 发件人: wangyunjian <wangyunjian@huawei.com>
> 发送时间: 2022年7月18日 21:09
> 收件人: dev@dpdk.org
> 抄送: chas3@att.com; humin (Q) <humin29@huawei.com>; Huangshaozhang <huangshaozhang@huawei.com>; jilei (F) <jilei8@huawei.com>; wangyunjian <wangyunjian@huawei.com>; stable@dpdk.org
> 主题: [dpdk-dev] [PATCH] net/bonding: fix array overflow in Rx burst
> 
> In bond_ethdev_rx_burst() function, we check the validity of the 'active_slave' as this code:
> if (++active_slave == slave_count)
> 	active_slave = 0;
> However, the value of 'active_slave' maybe equal to 'slave_count', when a slave is down. This is wrong and it can cause buffer overflow.
> This patch fixes the issue by using '>=' instead of '=='.
> 
> Fixes: e1110e977648 ("net/bonding: fix Rx slave fairness")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Lei Ji <jilei8@huawei.com>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
 >
 > Acked-by: Min Hu (Connor) <humin29@huawei.com>
 >

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-25 16:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10  6:43 [dpdk-stable] [PATCH] net/bonding:fix balance-xor link down stack overflow jilei
2021-08-10  7:50 ` Min Hu (Connor)
2022-05-20 15:33   ` [dpdk-dev] " Ferruh Yigit
2022-07-18 13:08 ` [dpdk-dev] [PATCH] net/bonding: fix array overflow in Rx burst Yunjian Wang
2022-07-20  1:28   ` 答复: " humin (Q)
2022-08-25 16:39     ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).