DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] net/memif: fix segfault with Tx burst larger than 255
@ 2023-12-05  4:05 Joyce Kong
  2023-12-05 18:33 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Joyce Kong @ 2023-12-05  4:05 UTC (permalink / raw)
  To: Jakub Grajciar, Morten Brørup, Joyce Kong, Ruifeng Wang
  Cc: dev, nd, stable, Liangxing Wang

There will be a segfault when tx burst size is larger than
256. This is because eth_memif_tx uses an index i which is
uint8_t to count transmitted nb_pkts. Extend i to uint16_t,
the same size as nb_pkts.

Fixes: b5613c8f9d0a ("net/memif: add a Tx fast path")
Cc: stable@dpdk.org

Reported-by: Liangxing Wang <liangxing.wang@arm.com>
Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 drivers/net/memif/rte_eth_memif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 7cc8c0da91..6f45a00172 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -684,7 +684,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		n_free = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE) - slot;
 	}
 
-	uint8_t i;
+	uint16_t i;
 	struct rte_mbuf **buf_tmp = bufs;
 	mbuf_head = *buf_tmp++;
 	struct rte_mempool *mp = mbuf_head->pool;
-- 
2.25.1


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

* Re: [PATCH v1] net/memif: fix segfault with Tx burst larger than 255
  2023-12-05  4:05 [PATCH v1] net/memif: fix segfault with Tx burst larger than 255 Joyce Kong
@ 2023-12-05 18:33 ` Stephen Hemminger
  2023-12-06  3:04   ` Joyce Kong
  2023-12-06 19:17   ` Ferruh Yigit
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Hemminger @ 2023-12-05 18:33 UTC (permalink / raw)
  To: Joyce Kong
  Cc: Jakub Grajciar, Morten Brørup, Ruifeng Wang, dev, nd,
	stable, Liangxing Wang

On Tue,  5 Dec 2023 04:05:24 +0000
Joyce Kong <joyce.kong@arm.com> wrote:

> There will be a segfault when tx burst size is larger than
> 256. This is because eth_memif_tx uses an index i which is
> uint8_t to count transmitted nb_pkts. Extend i to uint16_t,
> the same size as nb_pkts.
> 
> Fixes: b5613c8f9d0a ("net/memif: add a Tx fast path")
> Cc: stable@dpdk.org
> 
> Reported-by: Liangxing Wang <liangxing.wang@arm.com>
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---

I wonder if other drivers have same bug?

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

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

* RE: [PATCH v1] net/memif: fix segfault with Tx burst larger than 255
  2023-12-05 18:33 ` Stephen Hemminger
@ 2023-12-06  3:04   ` Joyce Kong
  2023-12-06 19:17   ` Ferruh Yigit
  1 sibling, 0 replies; 4+ messages in thread
From: Joyce Kong @ 2023-12-06  3:04 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Jakub Grajciar, Morten Brørup, Ruifeng Wang, dev, nd,
	stable, Liangxing Wang



> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Wednesday, December 6, 2023 2:34 AM
> To: Joyce Kong <Joyce.Kong@arm.com>
> Cc: Jakub Grajciar <jgrajcia@cisco.com>; Morten Brørup
> <mb@smartsharesystems.com>; Ruifeng Wang <Ruifeng.Wang@arm.com>;
> dev@dpdk.org; nd <nd@arm.com>; stable@dpdk.org; Liangxing Wang
> <Liangxing.Wang@arm.com>
> Subject: Re: [PATCH v1] net/memif: fix segfault with Tx burst larger than 255
> 
> On Tue,  5 Dec 2023 04:05:24 +0000
> Joyce Kong <joyce.kong@arm.com> wrote:
> 
> > There will be a segfault when tx burst size is larger than 256. This
> > is because eth_memif_tx uses an index i which is uint8_t to count
> > transmitted nb_pkts. Extend i to uint16_t, the same size as nb_pkts.
> >
> > Fixes: b5613c8f9d0a ("net/memif: add a Tx fast path")
> > Cc: stable@dpdk.org
> >
> > Reported-by: Liangxing Wang <liangxing.wang@arm.com>
> > Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> 
> I wonder if other drivers have same bug?

I don't think this is a common bug.
This is a special case as the bug is introduced for whether choosing the memif Tx fast path. 

> 
> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

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

* Re: [PATCH v1] net/memif: fix segfault with Tx burst larger than 255
  2023-12-05 18:33 ` Stephen Hemminger
  2023-12-06  3:04   ` Joyce Kong
@ 2023-12-06 19:17   ` Ferruh Yigit
  1 sibling, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2023-12-06 19:17 UTC (permalink / raw)
  To: Stephen Hemminger, Joyce Kong
  Cc: Jakub Grajciar, Morten Brørup, Ruifeng Wang, dev, nd,
	stable, Liangxing Wang

On 12/5/2023 6:33 PM, Stephen Hemminger wrote:
> On Tue,  5 Dec 2023 04:05:24 +0000
> Joyce Kong <joyce.kong@arm.com> wrote:
> 
>> There will be a segfault when tx burst size is larger than
>> 256. This is because eth_memif_tx uses an index i which is
>> uint8_t to count transmitted nb_pkts. Extend i to uint16_t,
>> the same size as nb_pkts.
>>
>> Fixes: b5613c8f9d0a ("net/memif: add a Tx fast path")
>> Cc: stable@dpdk.org
>>
>> Reported-by: Liangxing Wang <liangxing.wang@arm.com>
>> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
>> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
>> ---
> 
> I wonder if other drivers have same bug?
> 
> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
>

Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>


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

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

end of thread, other threads:[~2023-12-06 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05  4:05 [PATCH v1] net/memif: fix segfault with Tx burst larger than 255 Joyce Kong
2023-12-05 18:33 ` Stephen Hemminger
2023-12-06  3:04   ` Joyce Kong
2023-12-06 19:17   ` 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).