From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C834EA0524 for ; Fri, 5 Feb 2021 12:30:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C30CF4067B; Fri, 5 Feb 2021 12:30:50 +0100 (CET) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mails.dpdk.org (Postfix) with ESMTP id E6EE91889F6 for ; Fri, 5 Feb 2021 12:30:49 +0100 (CET) Received: by mail-wr1-f47.google.com with SMTP id p15so7263399wrq.8 for ; Fri, 05 Feb 2021 03:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ljYlEuj8oE94W4TU5oN8jvP5BPiYsCX5woZMGd3oBhU=; b=P2T3n5oQL6oMry82wWGUlxJ74l3B0axVbPLkiSJxHtWV/1mAVH8F1J6aNJcfyqEzIo XLo2D87u5XZbkLKikCI56OwIUACPbPYQEQB8CLHTrXwzfv5TkJJEesGcly24ILwZPb0z 1InAHUcj7xxPkkwie41YQxd8m3qk6IIcX8MN2mu+ExESv6geRrx6OFxv/mGWtNWdRnnM r+OLPrc09Bx4KmgTdOsqok9EqC2A5P6UnVqne3+JwTWe8Efidd0wP/tvYazUelJpsp1z RnNXAFz8DpLNNUa60X/Rtw9xuppLO0jHujPB+ucmnBquOKuASTWeR7IG9KKxRuHmyUVx wYFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ljYlEuj8oE94W4TU5oN8jvP5BPiYsCX5woZMGd3oBhU=; b=PMS+tS86XUWv+0Fqo75qTCyZ2K8Vv8mV5DiSu+E4T8Swb7maE4fG9RbREFdLkYNtNX g7WFOA8aR5QHuoneLb9u1duiym36OCKFrQdP8jPOeQIw9dPTKLFclI59qxXztfYVOoJu KZdd/hX+rAiAMt9d3eFnhaQN+fQZQazu05AVYX0Io/XfHvumkdUPZyspeo4KvZ7XXq8M MbkpCAsNu3SqACfIdCZj3Etfy7oRqD2kKiHPcO7jD5ZQR2nbeC7ze9zmgDqyS7DrcXF1 Y/EN8TkEl9Rx6kwc1Y3/YXOFaGo8k46VxeCRYJZsxl6qZGfChHSoyXIPPxkU90nUfkax 6WKw== X-Gm-Message-State: AOAM5307mWM+Eqa+nU/KOroXCyKuHs2GQlZ+A6MhGEf1p1xG3pUnYP5u CfbJ2xxNKZ5zmvswJp6VpDtSqBJT55LZ4vle X-Google-Smtp-Source: ABdhPJxbfpen9F8ezcFYZ4oMMe4UFhv0cy1QTu2l61KK5B+u1oltnm7IeEsnJJfKPdwYpsh63c0A1g== X-Received: by 2002:a5d:6947:: with SMTP id r7mr4528474wrw.150.1612524649697; Fri, 05 Feb 2021 03:30:49 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id 9sm12782474wra.80.2021.02.05.03.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:30:48 -0800 (PST) From: luca.boccassi@gmail.com To: Sunil Kumar Kori Cc: Nithin Dabilpuram , dpdk stable Date: Fri, 5 Feb 2021 11:16:35 +0000 Message-Id: <20210205111920.1272063-109-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/octeontx2: fix corruption in segments list' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/d777e0539606c6c5bcdef5195069b148b1d06742 Thanks. Luca Boccassi --- >From d777e0539606c6c5bcdef5195069b148b1d06742 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Kori Date: Mon, 21 Dec 2020 19:33:08 +0530 Subject: [PATCH] net/octeontx2: fix corruption in segments list [ upstream commit 54b79ac220b16465bf67d2bd65e3098379a5ce25 ] 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") Signed-off-by: Sunil Kumar Kori Acked-by: Nithin Dabilpuram --- 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 2da8efe77c..ffeade5952 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 926f614a4e..0ba3d3d96c 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.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:34.123353905 +0000 +++ 0109-net-octeontx2-fix-corruption-in-segments-list.patch 2021-02-05 11:18:28.966694159 +0000 @@ -1 +1 @@ -From 54b79ac220b16465bf67d2bd65e3098379a5ce25 Mon Sep 17 00:00:00 2001 +From d777e0539606c6c5bcdef5195069b148b1d06742 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 54b79ac220b16465bf67d2bd65e3098379a5ce25 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org