From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F2E39A0562 for ; Sat, 17 Apr 2021 20:38:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC1FD4068F; Sat, 17 Apr 2021 20:38:15 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id 35A734068F for ; Sat, 17 Apr 2021 20:38:14 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from viacheslavo@nvidia.com) with SMTP; 17 Apr 2021 21:38:11 +0300 Received: from nvidia.com (pegasus12.mtr.labs.mlnx [10.210.17.40]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 13HIcBol021230; Sat, 17 Apr 2021 21:38:11 +0300 From: Viacheslav Ovsiienko To: stable@dpdk.org Cc: bluca@debian.org, ktraynor@redhat.com Date: Sat, 17 Apr 2021 18:38:08 +0000 Message-Id: <20210417183808.5668-1-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH] net/mlx5: fix buffer leakage on Tx queue release X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 --- 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