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 D5DC0A055D for ; Mon, 1 Mar 2021 17:58:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C30EA22A2F9; Mon, 1 Mar 2021 17:58:24 +0100 (CET) Received: from mail-m975.mail.163.com (mail-m975.mail.163.com [123.126.97.5]) by mails.dpdk.org (Postfix) with ESMTP id AAC4040041; Mon, 1 Mar 2021 17:58:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=Q1870a/Y2YorSjp6Qw 5zIDK8UOM4FeYNzPap/jf3JZI=; b=cVxm8z9/1oA+dVmPir304RHcPMT/vL4xS5 TcLRXaFkMA73vOo/i7z9IwWvD5wDItaQqTXCAkS9whEq/we5fvJ+PM2OG631mGKj p+e1T0e9kv1e86wZNHWz/nPW/7gherNYaEQnvOQuqNVTlDFfVrY6/OUW/9KXVG10 gh7VoQIvA= Received: from localhost.localdomain.localdomain (unknown [112.10.65.103]) by smtp5 (Coremail) with SMTP id HdxpCgC3G8EmHT1gqI9OAA--.111S2; Tue, 02 Mar 2021 00:58:15 +0800 (CST) From: Jiawei Zhu <17826875952@163.com> To: dev@dpdk.org Cc: zhujiawei12@huawei.com, matan@nvidia.com, shahafs@nvidia.com, viacheslavo@nvidia.com, Jiawei Zhu <17826875952@163.com>, stable@dpdk.org Date: Mon, 1 Mar 2021 11:58:05 -0500 Message-Id: <1614617885-2650-1-git-send-email-17826875952@163.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1613384114-17855-1-git-send-email-17826875952@163.com> References: <1613384114-17855-1-git-send-email-17826875952@163.com> X-CM-TRANSID: HdxpCgC3G8EmHT1gqI9OAA--.111S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJr47ur4UKrW3CrW8XFy3CFg_yoW8XF43pw 4I9ryUAF98Jry0vF1DZa10qw15W3yrAr4j9ryDGwn3u3s5W345ur42gay2kFyDCrWkCa42 qrsFvwn8GF45Z37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UE_MfUUUUU= X-Originating-IP: [112.10.65.103] X-CM-SenderInfo: bprxmjywyxkmivs6il2tof0z/1tbirABI9lr7sZti2QABsj Subject: [dpdk-stable] [PATCH v2] net/mlx5: fix wrong segmented packet in Rx 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" Fixed issue could occur when Mbuf starvation happens in a middle of reception of a segmented packet. In such a situation, after release the segments of that packet, it does not align consumer index to the next stride. This would cause receive a wrong segmented packet. Here is a possible error. - we assume segs_n is 4 and we are receiving 4 segments multi-segment packet. - we fail to alloc mbuf when receive the 3th segment so it will free the mbufs which packet chain we have built. Here are the 1st and 2nd segment. - Rx queue in this stride, the 1st and the 2nd segment are fill the new mbuf and there data will be rand, but the 3th and 4th segment are still fill the last data. So next if still begin on this stride, it will receive wrong multi-segment packet. - So we should discarded this packets and pass this stride. Before exit the loop, we should align the next consumer index. Fixes: 15a756b63734 ("net/mlx5: fix possible NULL dereference in Rx path") Cc: stable@dpdk.org Signed-off-by: Jiawei Zhu <17826875952@163.com> --- v2: * Added extra explanation in commit message. --- drivers/net/mlx5/mlx5_rxtx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 2e4b87c..e3ce9fd 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -1480,6 +1480,9 @@ enum mlx5_txcmp_code { rte_mbuf_raw_free(pkt); pkt = rep; } + rq_ci >>= sges_n; + ++rq_ci; + rq_ci <<= sges_n; break; } if (!pkt) { -- 1.8.3.1