From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id EF8A31B5A4 for ; Tue, 18 Dec 2018 14:04:06 +0100 (CET) X-Amp-Result: UNSCANNABLE 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; 18 Dec 2018 05:04:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,368,1539673200"; d="scan'208";a="304781002" Received: from dpdk-tbie.sh.intel.com ([10.67.104.173]) by fmsmga005.fm.intel.com with ESMTP; 18 Dec 2018 05:04:05 -0800 Date: Tue, 18 Dec 2018 21:02:05 +0800 From: Tiwei Bie To: Hideyuki Yamashita Cc: dev@dpdk.org, ogawa.yasufumi@lab.ntt.co.jp Message-ID: <20181218130205.GA2464@dpdk-tbie.sh.intel.com> References: <201812181015.wBIAFlYk016726@ccmail04.silk.ntt-tx.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201812181015.wBIAFlYk016726@ccmail04.silk.ntt-tx.co.jp> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] vhost: delete freeing mac_addrs in eth_dev_close 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: , X-List-Received-Date: Tue, 18 Dec 2018 13:04:07 -0000 > vhost: delete freeing mac_addrs in eth_dev_close We are changing vhost PMD, so the component name is net/vhost. And generally we avoid using _ in title (devtools/check-git-log.sh can help do the check). So something like this will be better: net/vhost: fix double free of MAC addrs On Tue, Dec 18, 2018 at 07:14:30PM +0900, Hideyuki Yamashita wrote: > From: Hideyuki Yamashita > > When rte_dev_remove is called for vhost, eth_dev_close and > rte_eth_dev_release_port is called. > Both eth_dev_close and rte_eth_dev_release_port calls rte_free > for same data area(mac_addrs) and thus causes double free. > This patch fixes this by deleting rte_free for mac_addrs. It will be better to explain why rte_free() in eth_dev_close() instead of rte_eth_dev_release_port() should be removed. So having something like this in commit log will help others to have a better understanding of the background: """ The common data freeing has been moved to rte_eth_dev_release_port(), so freeing mac_addrs like this in eth_dev_close() is unnecessary and will cause double free. """ And as this is a fix, we need a "Fixes" line and also cc stable: Fixes: e16adf08e54d ("ethdev: free all common data when releasing port") Cc: stable@dpdk.org Besides, it would be better to put maintainers (which can be got by devtools/get-maintainer.sh) in the Cc or To list when sending the patch to get their attention. Thanks for the contribution! > > Signed-off-by: Hideyuki Yamashita > --- > drivers/net/vhost/rte_eth_vhost.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c > index 42bdfcbd5..b2cda0483 100644 > --- a/drivers/net/vhost/rte_eth_vhost.c > +++ b/drivers/net/vhost/rte_eth_vhost.c > @@ -1000,7 +1000,6 @@ eth_dev_close(struct rte_eth_dev *dev) > for (i = 0; i < dev->data->nb_tx_queues; i++) > rte_free(dev->data->tx_queues[i]); > > - rte_free(dev->data->mac_addrs); > free(internal->dev_name); > free(internal->iface_name); > rte_free(internal); > -- > 2.18.0 > > >