Skip to contentSkip to conversation

net/mlx5: fix Rx queue creation error flow

PATCH In review Michael Baum 2 participants 3 messages Dec 15, 2020 – Jan 6, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/mlx5: fix Rx queue creation error flow

In Rx queue creation, there are some validations for the Rx configuration.

When one of them fails, the MR btree memory was not freed what caused a memory leak.

Free it.

Fixes 974f1e7ef146 ("net/mlx5: add new memory region support")
---
 drivers/net/mlx5/mlx5_rxq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/mlx5/mlx5_rxq.c +1 -0
index da7a8b3..dbba5ca 100644
@@ -1689,6 +1689,7 @@ struct mlx5_rxq_ctrl *
 	LIST_INSERT_HEAD(&priv->rxqsctrl, tmpl, next);
 	return tmpl;
 error:
+	mlx5_mr_btree_free(&tmpl->rxq.mr_ctrl.cache_bh);
 	mlx5_free(tmpl);
 	return NULL;
 }
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 2/2 net/mlx5: fix Tx queue creation error flow

In Tx queue creation, there are two validations for the Tx configuration.

When one of them fails, the MR btree memory was not freed what caused a memory leak.

Free it.

Fixes f6d9ab4e769f ("net/mlx5: check Tx queue size overflow")
---
 drivers/net/mlx5/mlx5_txq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/mlx5/mlx5_txq.c +1 -0
index d96abef..b81bb4a 100644
@@ -1146,6 +1146,7 @@ struct mlx5_txq_ctrl *
 	LIST_INSERT_HEAD(&priv->txqsctrl, tmpl, next);
 	return tmpl;
 error:
+	mlx5_mr_btree_free(&tmpl->txq.mr_ctrl.cache_bh);
 	mlx5_free(tmpl);
 	return NULL;
 }
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH 2/2] net/mlx5: fix Tx queue creation error flow

15/12/2020 09:48, Michael Baum:

Quoted 6 lines

In Tx queue creation, there are two validations for the Tx configuration.

When one of them fails, the MR btree memory was not freed what caused a memory leak.

Quoted 7 lines

Free it.

Fixes f6d9ab4e769f ("net/mlx5: check Tx queue size overflow")

It is not really fixing the queue creation but a leak. In such case, it is more explicit to say in title:
"fix leak on [...] failure"

Series applied in next-net-mlx with above wording, thanks.