From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tiwei Bie Subject: Re: [PATCH] vhost: delete freeing mac_addrs in eth_dev_close Date: Tue, 18 Dec 2018 21:02:05 +0800 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 Cc: dev@dpdk.org, ogawa.yasufumi@lab.ntt.co.jp To: Hideyuki Yamashita 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) Content-Disposition: inline In-Reply-To: <201812181015.wBIAFlYk016726@ccmail04.silk.ntt-tx.co.jp> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > 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 > > >