patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix bug trunk is null
@ 2024-05-15  9:36 Haifei Luo
  2024-05-20 10:58 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Haifei Luo @ 2024-05-15  9:36 UTC (permalink / raw)
  To: matan, orika, viacheslavo, ferruh.yigit, Dariusz Sosnowski, Suanming Mou
  Cc: dev, thomas, rasland, stable

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: 42f463395f ("net/mlx5: support indexed pool non-lcore operations")
Cc: stable@dpdk.org

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 e28db2ec43..93c10f20a7 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.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/mlx5: fix bug trunk is null
  2024-05-15  9:36 [PATCH] net/mlx5: fix bug trunk is null Haifei Luo
@ 2024-05-20 10:58 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2024-05-20 10:58 UTC (permalink / raw)
  To: Haifei Luo, Matan Azrad, Ori Kam, Slava Ovsiienko, ferruh.yigit,
	Dariusz Sosnowski, Suanming Mou
  Cc: dev, NBU-Contact-Thomas Monjalon (EXTERNAL), stable

Hi,

From: Haifei Luo <haifeil@nvidia.com>
Sent: Wednesday, May 15, 2024 12:36 PM
To: Matan Azrad; Ori Kam; Slava Ovsiienko; ferruh.yigit@intel.com; Dariusz Sosnowski; Suanming Mou
Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon (EXTERNAL); Raslan Darawsheh; stable@dpdk.org
Subject: [PATCH] net/mlx5: fix bug trunk is null

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: 42f463395f ("net/mlx5: support indexed pool non-lcore operations")
Cc: stable@dpdk.org

Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-20 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-15  9:36 [PATCH] net/mlx5: fix bug trunk is null Haifei Luo
2024-05-20 10:58 ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).