[dpdk-dev] app/testpmd: fix crash of txonly with multiple segments

Message ID 20171227035138.28299-1-yskoh@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Yongseok Koh Dec. 27, 2017, 3:51 a.m. UTC
  Running txonly mode can crash with "--txpkts=20,470". copy_len should be
properly adjusted.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 app/test-pmd/txonly.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Wenzhuo Lu Jan. 5, 2018, 1:34 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yongseok Koh
> Sent: Wednesday, December 27, 2017 11:52 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Yongseok Koh <yskoh@mellanox.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] app/testpmd: fix crash of txonly with multiple
> segments
> 
> Running txonly mode can crash with "--txpkts=20,470". copy_len should be
> properly adjusted.
> 
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
  
Thomas Monjalon Jan. 9, 2018, 11:28 p.m. UTC | #2
> > Running txonly mode can crash with "--txpkts=20,470". copy_len should be
> > properly adjusted.
> > 
> > Fixes: af75078fece3 ("first public release")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

Applied, thanks
  

Patch

diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index 309c73893..4ce4d61cc 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -104,6 +104,7 @@  copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt,
 		buf = ((char*) buf + copy_len);
 		seg = seg->next;
 		seg_buf = rte_pktmbuf_mtod(seg, char *);
+		copy_len = seg->data_len;
 	}
 	rte_memcpy(seg_buf, buf, (size_t) len);
 }