Skip to contentSkip to conversation

net/mlx5: fix leak in HWS flow counter action

PATCH In review David Marchand 3 participants 3 messages Jan 27, 2025 – Feb 23, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix leak in HWS flow counter action

This was caught by our internal covscan.
mp_name can be leaked in case of errors.

Fixes 4d368e1da3a4 ("net/mlx5: support flow counter action for HWS")
---
 drivers/net/mlx5/mlx5_hws_cnt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_hws_cnt.c +2 -1
index 0197c098f6..eaceedd5ba 100644
@@ -723,7 +723,7 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
 	if (priv->sh->cnt_svc == NULL) {
 		ret = mlx5_hws_cnt_svc_init(priv->sh, error);
 		if (ret)
-			return ret;
+			goto error;
 	}
 	cparam.fetch_sz = HWS_CNT_CACHE_FETCH_DEFAULT;
 	cparam.preload_sz = HWS_CNT_CACHE_PRELOAD_DEFAULT;
@@ -767,6 +767,7 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
 	MLX5_ASSERT(ret);
 	mlx5_hws_cnt_pool_destroy(priv->sh, cpool);
 	priv->hws_cpool = NULL;
+	mlx5_free(mp_name);
 	return ret;
 }
 
Signature · 1 line
2.47.1
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Monday, January 27, 2025 11:54
To: [email protected]
Cc: [email protected]; Dariusz Sosnowski <[email protected]>; Slava Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>; Jack Min <[email protected]>
Subject: [PATCH] net/mlx5: fix leak in HWS flow counter action

External email: Use caution opening links or attachments

Quoted 7 lines

This was caught by our internal covscan.
mp_name can be leaked in case of errors.

Fixes 4d368e1da3a4 ("net/mlx5: support flow counter action for HWS")

Best regards,
Dariusz Sosnowski

#2 lore raw
In reply to David Marchand

Hi,

From: David Marchand <[email protected]>
Sent: Monday, January 27, 2025 12:53 PM
To: [email protected]
Cc: [email protected]; Dariusz Sosnowski; Slava Ovsiienko; Bing Zhao; Ori Kam; Suanming Mou; Matan Azrad; Jack Min
Subject: [PATCH] net/mlx5: fix leak in HWS flow counter action

This was caught by our internal covscan.
mp_name can be leaked in case of errors.

Fixes 4d368e1da3a4 ("net/mlx5: support flow counter action for HWS")

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh