From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 34965A09EE;
	Tue, 15 Dec 2020 09:49:01 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 19536C96A;
	Tue, 15 Dec 2020 09:48:57 +0100 (CET)
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by dpdk.org (Postfix) with ESMTP id 445832142
 for <dev@dpdk.org>; Tue, 15 Dec 2020 09:48:55 +0100 (CET)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 michaelba@nvidia.com) with SMTP; 15 Dec 2020 10:48:50 +0200
Received: from nvidia.com (pegasus07.mtr.labs.mlnx [10.210.16.112])
 by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0BF8mc0U019593;
 Tue, 15 Dec 2020 10:48:50 +0200
From: Michael Baum <michaelba@nvidia.com>
To: dev@dpdk.org
Cc: Matan Azrad <matan@nvidia.com>, Raslan Darawsheh <rasland@nvidia.com>,
 Viacheslav Ovsiienko <viacheslavo@nvidia.com>, stable@dpdk.org
Date: Tue, 15 Dec 2020 08:48:32 +0000
Message-Id: <1608022112-13036-2-git-send-email-michaelba@nvidia.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1608022112-13036-1-git-send-email-michaelba@nvidia.com>
References: <1608022112-13036-1-git-send-email-michaelba@nvidia.com>
Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: fix Tx queue creation error flow
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_txq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index d96abef..b81bb4a 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -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;
 }
-- 
1.8.3.1