From patchwork Wed May 25 05:56:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joyce Kong X-Patchwork-Id: 111785 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11C4AA0548; Wed, 25 May 2022 07:56:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB001400EF; Wed, 25 May 2022 07:56:57 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 1F132400D6; Wed, 25 May 2022 07:56:56 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6AA5A1FB; Tue, 24 May 2022 22:56:55 -0700 (PDT) Received: from net-arm-n1amp-02.shanghai.arm.com (net-arm-n1amp-02.shanghai.arm.com [10.169.210.136]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8974D3F73D; Tue, 24 May 2022 22:56:52 -0700 (PDT) From: Joyce Kong To: Jakub Grajciar , Ferruh Yigit Cc: dev@dpdk.org, nd@arm.com, Joyce Kong , stable@dpdk.org, Ferruh Yigit , Ruifeng Wang Subject: [PATCH] net/memif: fix overwriting of head segment Date: Wed, 25 May 2022 05:56:35 +0000 Message-Id: <20220525055635.308716-1-joyce.kong@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Signed-off-by: Joyce Kong Reviewed-by: Ruifeng Wang --- 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 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 {