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 789F6A0C43; Wed, 12 May 2021 15:18:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E56CE41104; Wed, 12 May 2021 15:18:42 +0200 (CEST) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id 99EEC410E3; Wed, 12 May 2021 15:18:39 +0200 (CEST) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FgFfP4DNvzBtVl; Wed, 12 May 2021 21:15:57 +0800 (CST) Received: from localhost (10.174.243.60) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Wed, 12 May 2021 21:18:29 +0800 From: wangyunjian To: CC: , , , , Yunjian Wang , Date: Wed, 12 May 2021 21:18:28 +0800 Message-ID: <1620825508-29440-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.243.60] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 7cd35cd3ca..c72587b7ef 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -201,6 +201,8 @@ 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