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 C5639A0C43; Wed, 15 Sep 2021 07:08:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF309410E5; Wed, 15 Sep 2021 07:08:47 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id B16CF4003C; Wed, 15 Sep 2021 07:08:44 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="209446381" X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="209446381" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2021 22:08:43 -0700 X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="544454686" Received: from unknown (HELO localhost.localdomain) ([10.240.183.93]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2021 22:08:41 -0700 From: dapengx.yu@intel.com To: Chas Williams , "Min Hu (Connor)" Cc: dev@dpdk.org, Dapeng Yu , stable@dpdk.org Date: Wed, 15 Sep 2021 13:08:02 +0800 Message-Id: <20210915050802.454669-1-dapengx.yu@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [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" 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; -- 2.27.0