diff mbox series

net/memif: fix overwriting of head segment

Message ID 20220525055635.308716-1-joyce.kong@arm.com (mailing list archive)
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series net/memif: fix overwriting of head segment | expand

Checks

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

Commit Message

Joyce Kong May 25, 2022, 5:56 a.m. UTC
The 'dst_off' was reset in multi segment case.
This caused memif buffer segment to write to
beginning of mbuf, overwriting previous data.
Fix it with this patch.

Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Cc: stable@dpdk.org

Reported-by: Ferruh Yigit <ferruh.yigit@xilinx.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(-)

Comments

Ferruh Yigit May 25, 2022, 9:14 p.m. UTC | #1
On 5/25/2022 6:56 AM, Joyce Kong wrote:
> The 'dst_off' was reset in multi segment case.
> This caused memif buffer segment to write to
> beginning of mbuf, overwriting previous data.
> Fix it with this patch.
> 
> Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
> Cc:stable@dpdk.org
> 
> Reported-by: Ferruh Yigit<ferruh.yigit@xilinx.com>
> Signed-off-by: Joyce Kong<joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang<ruifeng.wang@arm.com>

Applied to dpdk-next-net/main, thanks.
diff mbox series

Patch

diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 587ad45576..dd951b8296 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -348,13 +348,13 @@  eth_memif_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			goto no_free_bufs;
 		mbuf = mbuf_head;
 		mbuf->port = mq->in_port;
+		dst_off = 0;
 
 next_slot:
 		s0 = cur_slot & mask;
 		d0 = &ring->desc[s0];
 
 		src_len = d0->length;
-		dst_off = 0;
 		src_off = 0;
 
 		do {