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 B7148A0C41; Wed, 15 Sep 2021 10:16:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C7DC4003F; Wed, 15 Sep 2021 10:16:14 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id A3B9E4003C; Wed, 15 Sep 2021 10:16:13 +0200 (CEST) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4H8Xxc60fXzYpbq; Wed, 15 Sep 2021 16:12:04 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Wed, 15 Sep 2021 16:16:10 +0800 To: "Yu, DapengX" , Chas Williams CC: "dev@dpdk.org" , "stable@dpdk.org" References: <20210915050802.454669-1-dapengx.yu@intel.com> <2c3d6eac-92fd-fa2c-7ad5-5ff5bc99e1be@huawei.com> From: "Min Hu (Connor)" Message-ID: <6f5fab51-fd98-3094-9f4c-4baba66ea53f@huawei.com> Date: Wed, 15 Sep 2021 16:16:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="iso-2022-jp"; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.103.128] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH] net/bonding: fix memory leak on closing device 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" Acked-by: Min Hu (Connor) 在 2021/9/15 15:18, Yu, DapengX 写道: > > >> -----Original Message----- >> From: Min Hu (Connor) >> Sent: Wednesday, September 15, 2021 2:59 PM >> To: Yu, DapengX ; Chas Williams >> Cc: dev@dpdk.org; stable@dpdk.org >> Subject: Re: [PATCH] net/bonding: fix memory leak on closing device >> >> Hi, dapengx, >> Why not free internals->kvlist at the end of >> "bond_ethdev_configure" ? >> Does it call some bugs? > > Just try not to deviate too much from the previous fix: 144dc4739975 ("net/bonding: fix leak on remove") > Since it is reasonable. > And releasing port resource in bond_ethdev_close() is in order to > avoid that memory leak detect tool to find memory leak after device is closed. > > free internals->kvlist at the end of "bond_ethdev_configure" is also ok. > >> >> 在 2021/9/15 13:08, dapengx.yu@intel.com 写道: >>> From: Dapeng Yu >>> >>> If the bond device was created by vdev mode, the kvlist was not free >>> after the bond device was closed. >>> >>> This patch fixes it. >>> >>> Fixes: 144dc4739975 ("net/bonding: fix leak on remove") >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Dapeng Yu >>> --- >>> drivers/net/bonding/rte_eth_bond_pmd.c | 5 +++-- >>> 1 file changed, 3 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c >>> b/drivers/net/bonding/rte_eth_bond_pmd.c >>> index a6755661c4..2e96b850fb 100644 >>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c >>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c >>> @@ -2163,6 +2163,9 @@ bond_ethdev_close(struct rte_eth_dev *dev) >>> */ >>> rte_mempool_free(internals->mode6.mempool); >>> >>> + if (internals->kvlist != NULL) >>> + rte_kvargs_free(internals->kvlist); >>> + >>> return 0; >>> } >>> >>> @@ -3475,8 +3478,6 @@ bond_remove(struct rte_vdev_device *dev) >>> ret = bond_ethdev_stop(eth_dev); >>> bond_ethdev_close(eth_dev); >>> } >>> - if (internals->kvlist != NULL) >>> - rte_kvargs_free(internals->kvlist); >>> rte_eth_dev_release_port(eth_dev); >>> >>> return ret; >>> > . >