From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 4A337454E9
	for <public@inbox.dpdk.org>; Tue, 25 Jun 2024 02:03:07 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 463B842709;
	Tue, 25 Jun 2024 02:03:07 +0200 (CEST)
Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com
 [209.85.221.43]) by mails.dpdk.org (Postfix) with ESMTP id 4056B410DC
 for <stable@dpdk.org>; Tue, 25 Jun 2024 02:03:05 +0200 (CEST)
Received: by mail-wr1-f43.google.com with SMTP id
 ffacd0b85a97d-364c9ec17d1so3141721f8f.0
 for <stable@dpdk.org>; Mon, 24 Jun 2024 17:03:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719273785; x=1719878585; darn=dpdk.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=/vKbjzfs5SAOg8fcvSY9jpN1qGrKjrAEaDWRoNGttmM=;
 b=CFoSNhdO2xEUDn9g2D6jVqGtgxFhW86PJuVvIWTfcA6sI6bxhk7s9TcyaLaaon0P5i
 uCATawunmb11d6q3dhEiUw+r6HrnztXOxd/bAssfHZ3xZUFoNhyeORlci4LIZXyZQsRN
 DsI88ogBuq0Pb3xJ9wMMQvjhXUphn+GzYoXsWgbIm1+3Hf4soPrIxiizqgdZ4ywE9KYs
 vWCcbzCrN8d3o1A6vJ7VLmWhSqFV2DKtjUTYQSDY0nZnhg6/tFBAG3b/h5bVKuL/O7Mx
 MNUv5wsfVgKSzWBeYIgOb3AAyWQREI9WqW5zR3gntPF+qF4TIIbU+o2lN1Dg0/Vpd5qM
 JHQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719273785; x=1719878585;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=/vKbjzfs5SAOg8fcvSY9jpN1qGrKjrAEaDWRoNGttmM=;
 b=OuNisEUwOMOj0u8sACEs69+DVykrNNXr+JsJEUlCG9VpdPl6QpFcsQ12elysCR4G97
 zKC2nxLpTpLd4G1IKhwc51GWOqG+cD3b9zXSHuizf70IqAUWWFenjaNCgWm8edl3mnrI
 1hA8PZKsFPqRIXe+mBxdZ/1qJUxKO8+kGIJcpKVA5ibM8zI+/OmcafR75XH0EO8yiJRx
 dQehyiklrdaSFXwVQv/jD7uSXpeYLrlb3EDlqAD0OlEug69URwMt4HN6VOwTFzfbF8J7
 mwur0+1k4glETcvLcLgLo8ALYxKHbQo5tFxX+SNATYzzVeFwdYvkrs8unUw/4EW927Y1
 l0nw==
X-Forwarded-Encrypted: i=1;
 AJvYcCVuJrX7/skDiDMj5npUh52I0hOMTmm4+ILtJ1vzpZ1qdzwX2R2vsvvJGSxbWNM8In04FR2qFXrTZkXsAfD89Yo=
X-Gm-Message-State: AOJu0YxtBqIKkZGvTvenE6rYafs8kCbPPZIoiqTCpfxUN9eZg6osiuWu
 lS3+xaaaietYBoXTOHVNh7d9l2dNu/42gNluIEHs8a1354Z3uf9TmhYKvRre
X-Google-Smtp-Source: AGHT+IGy1LQ65yZZohPTkFxPD5EVo4NAeu+qXE9LOm5UB6NedjT6MGArIhsJDko5ufri2ZvA+DzMxA==
X-Received: by 2002:a5d:410e:0:b0:366:f2a5:e1b3 with SMTP id
 ffacd0b85a97d-366f2a5e1f1mr2968920f8f.56.1719273784872; 
 Mon, 24 Jun 2024 17:03:04 -0700 (PDT)
Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-3663a8c8954sm11224263f8f.98.2024.06.24.17.03.04
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 24 Jun 2024 17:03:04 -0700 (PDT)
From: luca.boccassi@gmail.com
To: Haifei Luo <haifeil@nvidia.com>
Cc: Suanming Mou <suanmingm@nvidia.com>,
	dpdk stable <stable@dpdk.org>
Subject: patch 'net/mlx5: fix indexed pool with invalid index' has been queued
 to stable release 22.11.6
Date: Tue, 25 Jun 2024 00:58:57 +0100
Message-Id: <20240624235907.885628-71-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com>
References: <20240624235907.885628-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

Hi,

FYI, your patch has been queued to stable release 22.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/27/24. 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/a752b66a9a502642c47cb4d0f99efbbdc63e62a5

Thanks.

Luca Boccassi

---
>From a752b66a9a502642c47cb4d0f99efbbdc63e62a5 Mon Sep 17 00:00:00 2001
From: Haifei Luo <haifeil@nvidia.com>
Date: Wed, 15 May 2024 12:36:53 +0300
Subject: [PATCH] net/mlx5: fix indexed pool with invalid index

[ upstream commit 16a7b5d14e3dfb4d3d385375b94bb2f360883cd6 ]

When _mlx5_ipool_get_cache is called, idx may be invalid and
the "trunk" is NULL in this case. Assert is not correct and add
checks that if trunk is NULL or not. Return NULL If trunk is NULL.

Fixes: 42f463395f8f ("net/mlx5: support indexed pool non-lcore operations")

Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
 drivers/net/mlx5/mlx5_utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.c
index b295702fd4..bbe07cd7a3 100644
--- a/drivers/net/mlx5/mlx5_utils.c
+++ b/drivers/net/mlx5/mlx5_utils.c
@@ -379,7 +379,8 @@ _mlx5_ipool_get_cache(struct mlx5_indexed_pool *pool, int cidx, uint32_t idx)
 	idx -= 1;
 	trunk_idx = mlx5_trunk_idx_get(pool, idx);
 	trunk = lc->trunks[trunk_idx];
-	MLX5_ASSERT(trunk);
+	if (!trunk)
+		return NULL;
 	entry_idx = idx - mlx5_trunk_idx_offset_get(pool, trunk_idx);
 	return &trunk->data[entry_idx * pool->cfg.size];
 }
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-06-25 00:22:17.232911179 +0100
+++ 0071-net-mlx5-fix-indexed-pool-with-invalid-index.patch	2024-06-25 00:22:13.241186790 +0100
@@ -1 +1 @@
-From 16a7b5d14e3dfb4d3d385375b94bb2f360883cd6 Mon Sep 17 00:00:00 2001
+From a752b66a9a502642c47cb4d0f99efbbdc63e62a5 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 16a7b5d14e3dfb4d3d385375b94bb2f360883cd6 ]
+
@@ -11 +12,0 @@
-Cc: stable@dpdk.org
@@ -20 +21 @@
-index fc03cc054b..d52119f0be 100644
+index b295702fd4..bbe07cd7a3 100644