[dpdk-dev] [PATCH] regex/mlx5: fix RegEx probing error flow

Michael Baum michaelba at nvidia.com
Tue Aug 31 22:38:38 CEST 2021


In RegEx device probing, there is register read trying after context
device creation.

When the reading fails, the context device was not freed what caused a
memory leak.

Free it.

Fixes: f324162e8e77 ("regex/mlx5: support combined rule file")
Cc: stable at dpdk.org

Signed-off-by: Michael Baum <michaelba at nvidia.com>
---
 drivers/regex/mlx5/mlx5_regex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
index f17b6df47f..8866a4d0c6 100644
--- a/drivers/regex/mlx5/mlx5_regex.c
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -171,7 +171,7 @@ mlx5_regex_dev_probe(struct rte_device *rte_dev)
 					    MLX5_RXP_CSR_IDENTIFIER, &val);
 	if (ret) {
 		DRV_LOG(ERR, "CSR read failed!");
-		return -1;
+		goto dev_error;
 	}
 	if (val == MLX5_RXP_BF2_IDENTIFIER)
 		priv->is_bf2 = 1;
-- 
2.25.1



More information about the dev mailing list