patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: fix buffer leakage on Tx queue release
@ 2021-04-17 18:38 Viacheslav Ovsiienko
  2021-04-19  8:56 ` Kevin Traynor
  0 siblings, 1 reply; 2+ messages in thread
From: Viacheslav Ovsiienko @ 2021-04-17 18:38 UTC (permalink / raw)
  To: stable; +Cc: bluca, ktraynor

On Tx queue release the mlx5 PMD freed the mbufs stored
in the elts array (holds buffers being transmitted) only
for zero reference counter. The one reference is hold
for the queue release call. Hence, on device stop call
the reference counter was at least 2 and elts array was
not freed. If application called the device start without
queue release the elts array was cleaned up and the
remaining mbufs were lost.

Fixes: 6e78005a9b30 ("net/mlx5: add reference counter on DPDK Tx queues")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

---
This patch is applicable for 19.11LTS only (and possible for
preceeding releases), no bug in 20.11 and Upstream.

 drivers/net/mlx5/mlx5_txq.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 9c929a57ea..d9576e7a64 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -1415,6 +1415,8 @@ mlx5_txq_release(struct rte_eth_dev *dev, uint16_t idx)
 	txq = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq);
 	if (txq->obj && !mlx5_txq_obj_release(txq->obj))
 		txq->obj = NULL;
+	if (rte_atomic32_read(&txq->refcnt <= 2)
+		txq_free_elts(txq);
 	if (rte_atomic32_dec_and_test(&txq->refcnt)) {
 		txq_free_elts(txq);
 		mlx5_mr_btree_free(&txq->txq.mr_ctrl.cache_bh);
-- 
2.28.0


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

* Re: [dpdk-stable] [PATCH] net/mlx5: fix buffer leakage on Tx queue release
  2021-04-17 18:38 [dpdk-stable] [PATCH] net/mlx5: fix buffer leakage on Tx queue release Viacheslav Ovsiienko
@ 2021-04-19  8:56 ` Kevin Traynor
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Traynor @ 2021-04-19  8:56 UTC (permalink / raw)
  To: Viacheslav Ovsiienko, stable; +Cc: bluca, Christian Ehrhardt

Relevant for 19.11 and 20.11 LTS

+cc Christian (19.11 LTS maintainer)

On 17/04/2021 19:38, Viacheslav Ovsiienko wrote:
> On Tx queue release the mlx5 PMD freed the mbufs stored
> in the elts array (holds buffers being transmitted) only
> for zero reference counter. The one reference is hold
> for the queue release call. Hence, on device stop call
> the reference counter was at least 2 and elts array was
> not freed. If application called the device start without
> queue release the elts array was cleaned up and the
> remaining mbufs were lost.
> 
> Fixes: 6e78005a9b30 ("net/mlx5: add reference counter on DPDK Tx queues")
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 
> ---
> This patch is applicable for 19.11LTS only (and possible for
> preceeding releases), no bug in 20.11 and Upstream.
> 
>  drivers/net/mlx5/mlx5_txq.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
> index 9c929a57ea..d9576e7a64 100644
> --- a/drivers/net/mlx5/mlx5_txq.c
> +++ b/drivers/net/mlx5/mlx5_txq.c
> @@ -1415,6 +1415,8 @@ mlx5_txq_release(struct rte_eth_dev *dev, uint16_t idx)
>  	txq = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq);
>  	if (txq->obj && !mlx5_txq_obj_release(txq->obj))
>  		txq->obj = NULL;
> +	if (rte_atomic32_read(&txq->refcnt <= 2)
> +		txq_free_elts(txq);
>  	if (rte_atomic32_dec_and_test(&txq->refcnt)) {
>  		txq_free_elts(txq);
>  		mlx5_mr_btree_free(&txq->txq.mr_ctrl.cache_bh);
> 


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

end of thread, other threads:[~2021-04-19  8:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-17 18:38 [dpdk-stable] [PATCH] net/mlx5: fix buffer leakage on Tx queue release Viacheslav Ovsiienko
2021-04-19  8:56 ` Kevin Traynor

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).