From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 50FD7A0573; Thu, 5 Mar 2020 03:18:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 81D9A1BFAA; Thu, 5 Mar 2020 03:18:17 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 8DF072C02 for ; Thu, 5 Mar 2020 03:18:15 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 18:18:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,516,1574150400"; d="scan'208";a="439340563" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by fmsmga005.fm.intel.com with ESMTP; 04 Mar 2020 18:18:12 -0800 Date: Thu, 5 Mar 2020 10:15:56 +0800 From: Ye Xiaolong To: Itsuro Oda Cc: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, anatoly.burakov@intel.com, dev@dpdk.org Message-ID: <20200305021556.GA10157@intel.com> References: <20200303000329.823-1-oda@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200303000329.823-1-oda@valinux.co.jp> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] net/vhost: fix potential memory leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" On 03/03, Itsuro Oda wrote: >If a vhost device is closed before eth_dev_configure is done >to the device, internal resources allocated to the device >does not freed. This patch fixes it. s/does not freed/would not be freed > >Fixes: 3d01b759d267 ("net/vhost: delay driver setup") Cc: stable@dpdk.org > >Signed-off-by: Itsuro Oda >--- > drivers/net/vhost/rte_eth_vhost.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > >diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c >index 458ed58f5..1ed977e9b 100644 >--- a/drivers/net/vhost/rte_eth_vhost.c >+++ b/drivers/net/vhost/rte_eth_vhost.c >@@ -1065,16 +1065,14 @@ eth_dev_close(struct rte_eth_dev *dev) > > eth_dev_stop(dev); > >- rte_vhost_driver_unregister(internal->iface_name); >- > list = find_internal_resource(internal->iface_name); >- if (!list) >- return; >- >- pthread_mutex_lock(&internal_list_lock); >- TAILQ_REMOVE(&internal_list, list, next); >- pthread_mutex_unlock(&internal_list_lock); >- rte_free(list); >+ if (list) { >+ rte_vhost_driver_unregister(internal->iface_name); >+ pthread_mutex_lock(&internal_list_lock); >+ TAILQ_REMOVE(&internal_list, list, next); >+ pthread_mutex_unlock(&internal_list_lock); >+ rte_free(list); >+ } > > if (dev->data->rx_queues) > for (i = 0; i < dev->data->nb_rx_queues; i++) >-- >2.17.0 > For the rest, Reviewed-by: Xiaolong Ye