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 EAF74A0C47; Thu, 13 May 2021 05:39:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE3BF4067E; Thu, 13 May 2021 05:39:47 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 3DECD4003F; Thu, 13 May 2021 05:39:47 +0200 (CEST) Received: from dggeml701-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Fgck80jdGzWhtr; Thu, 13 May 2021 11:35:28 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggeml701-chm.china.huawei.com (10.3.17.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 13 May 2021 11:39:44 +0800 Received: from localhost (10.174.243.60) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 13 May 2021 11:39:44 +0800 From: wangyunjian To: CC: , , , , Yunjian Wang , Date: Thu, 13 May 2021 11:38:56 +0800 Message-ID: <9fe1d9e5dea152997fa7bd9748154ef51755a29b.1620876356.git.wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.243.60] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2 1/2] net/mlx4: fix mem leak when a device configured repeatedly X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yunjian Wang Currently, configuring a mlx device, it will allocate its own process private in mlx5_proc_priv_init() and only frees it when closing the device. This will lead to a memory leak, when a device is configured repeatedly. For example: for(...) do rte_eth_dev_configure rte_eth_rx_queue_setup rte_eth_tx_queue_setup rte_eth_dev_start rte_eth_dev_stop done Fixes: 97d37d2c1f6b ("net/mlx4: remove device register remap") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/net/mlx4/mlx4.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 7cd35cd3ca..c522157a0a 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -201,6 +201,7 @@ mlx4_proc_priv_init(struct rte_eth_dev *dev) struct mlx4_proc_priv *ppriv; size_t ppriv_size; + mlx4_proc_priv_uninit(dev); /* * UAR register table follows the process private structure. BlueFlame * registers for Tx queues are stored in the table. -- 2.23.0