From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7DEEFA0A00 for ; Mon, 28 Dec 2020 13:17:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4E829CA38; Mon, 28 Dec 2020 13:17:56 +0100 (CET) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by dpdk.org (Postfix) with ESMTP id F127EC9F2; Mon, 28 Dec 2020 13:17:52 +0100 (CET) Received: by mail-pf1-f172.google.com with SMTP id t8so6203617pfg.8; Mon, 28 Dec 2020 04:17:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Hw4o8mWDAmjRhH80jto/3Uw85dqOgNjl7uu4qK6MWjA=; b=O5idAmYd/1bY2oxfIV7Xe1vJzlXt34vLioXyYQ0WOVSKFIUf+22sIsngVwVK1RkUxK kvBZUcYA0SsAaiiV2xiuoE40d8lI/qCDT6tVNhizhMaRlZ0J1oxvRAeiYhGm0HkA82h6 ZOSmMCoY3mTt4/srQOZDOkcQcUIHpcihSpkyC/5fkhyp1DAVK9oJEL/Simc6yLTbbKv/ Jij5SYuNpkjHIcXjdfvMIWgEmzFhy5uWI2Xb1Tg7brM8WDvSGbppWYwAnnbFFzdXia7m hv46WEj2P42oAZR18vg+2TZMylrBUavgT1AJriNBfun1Z1/U+ufPbRZ2h8jVn2u1nQZI KtIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Hw4o8mWDAmjRhH80jto/3Uw85dqOgNjl7uu4qK6MWjA=; b=sbT5XZL0RdS8iJEQxAUOKVCt2LSyMxaRV2y+EcLypEmimRv81PzXkZTnIbPdYDkiKE 7CtWTlkRE8FmBEdRDOlBLpvErIoXqFoxp5295EjyAVNkKntfMnaZz7V+0f/ljrczCO2H qPYTqIfblc7IAtuGWus7lofaFro+DNjmvErMP7GrfJjGtVEogwlX8mmciqRVaZ1kryNF cJdyNTIaI6pJoeII7La+CdLW8b4r78AzRaP+gxWGd+6/lQUA+xuWz6ZWZf1Tds0zh1XQ 4f7QPi5uutE8I+L2Aiau7uK/mCg+hbtRJzsigtSWwVIV4zX1j72jVV4ORXIGssYn1VuG 2sRw== X-Gm-Message-State: AOAM530AftJSewHKr5NrQ3M35KQj7lidQenPpbFP2Nz26q8p8CVSmA7y GpX8x6kYtUIlosvW/nL7kxM= X-Google-Smtp-Source: ABdhPJy271pI93SkA7j7isEWVq05Y+Uoc6BSsOeenFI4CFD/t9i4SzgdlT5ef3F1JPb6nCHfFDd0ew== X-Received: by 2002:a63:5f12:: with SMTP id t18mr43853885pgb.308.1609157871000; Mon, 28 Dec 2020 04:17:51 -0800 (PST) Received: from gmail.com ([1.6.215.26]) by smtp.gmail.com with ESMTPSA id b13sm37077829pfi.162.2020.12.28.04.17.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Dec 2020 04:17:50 -0800 (PST) Date: Mon, 28 Dec 2020 17:47:43 +0530 From: Nithin Dabilpuram To: skori@marvell.com Cc: Jerin Jacob , Kiran Kumar K , dev@dpdk.org, stable@dpdk.org Message-ID: References: <20201221140308.9809-1-skori@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201221140308.9809-1-skori@marvell.com> Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/octeontx2: fix corruption in segments list X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Mon, Dec 21, 2020 at 07:33:08PM +0530, skori@marvell.com wrote: > From: Sunil Kumar Kori > > On Tx, lastseg->next is not being reset to null for multi segmented packet > and same mbuf can be used on Rx which has a stale mbuf entry into > mbuf->next. > > On Rx, application receives mbuf with mbuf->next uninitialized though > mbuf->nb_segs is correct. Application iterates over all segments using > mbuf->next ignoring mbuf->nb_segs which leads to undefined behavior. > > So earlier assumption of just having right value in mbuf->nb_segs is > enough, is incorrect. Mbuf must contain valid and synced value in > nb_segs and next pointer. > > Fixes: 364eb0e46683 ("net/octeontx2: avoid per packet barrier with multi segment") > Cc: stable@dpdk.org > > Signed-off-by: Sunil Kumar Kori > --- > drivers/net/octeontx2/otx2_rx.c | 6 ++++++ > drivers/net/octeontx2/otx2_rx.h | 7 +++++-- > 2 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/octeontx2/otx2_rx.c b/drivers/net/octeontx2/otx2_rx.c > index 2da8efe77..ffeade595 100644 > --- a/drivers/net/octeontx2/otx2_rx.c > +++ b/drivers/net/octeontx2/otx2_rx.c > @@ -279,6 +279,12 @@ nix_recv_pkts_vector(void *rx_queue, struct rte_mbuf **rx_pkts, > vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2); > vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3); > > + /* Update that no more segments */ > + mbuf0->next = NULL; > + mbuf1->next = NULL; > + mbuf2->next = NULL; > + mbuf3->next = NULL; > + > /* Store the mbufs to rx_pkts */ > vst1q_u64((uint64_t *)&rx_pkts[packets], mbuf01); > vst1q_u64((uint64_t *)&rx_pkts[packets + 2], mbuf23); > diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h > index 926f614a4..0ba3d3d96 100644 > --- a/drivers/net/octeontx2/otx2_rx.h > +++ b/drivers/net/octeontx2/otx2_rx.h > @@ -215,6 +215,7 @@ nix_cqe_xtract_mseg(const struct nix_rx_parse_s *rx, > iova_list = (const rte_iova_t *)(iova_list + 1); > } > } > + mbuf->next = NULL; > } > > static __rte_always_inline uint16_t > @@ -330,10 +331,12 @@ otx2_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const uint32_t tag, > *(uint64_t *)(&mbuf->rearm_data) = val; > mbuf->pkt_len = len; > > - if (flag & NIX_RX_MULTI_SEG_F) > + if (flag & NIX_RX_MULTI_SEG_F) { > nix_cqe_xtract_mseg(rx, mbuf, val); > - else > + } else { > mbuf->data_len = len; > + mbuf->next = NULL; > + } > } > > #define CKSUM_F NIX_RX_OFFLOAD_CHECKSUM_F > -- > 2.25.1 > Acked-by: Nithin Dabilpuram