DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tiwei Bie <tiwei.bie@intel.com>
To: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
Cc: dev@dpdk.org, ogawa.yasufumi@lab.ntt.co.jp
Subject: Re: [dpdk-dev] [PATCH] vhost: delete freeing mac_addrs in eth_dev_close
Date: Tue, 18 Dec 2018 21:02:05 +0800	[thread overview]
Message-ID: <20181218130205.GA2464@dpdk-tbie.sh.intel.com> (raw)
In-Reply-To: <201812181015.wBIAFlYk016726@ccmail04.silk.ntt-tx.co.jp>


> 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 <yamashita.hideyuki@po.ntt-tx.co.jp>
> 
> 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 <yamashita.hideyuki@po.ntt-tx.co.jp>
> ---
>  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
> 
> 
> 

      reply	other threads:[~2018-12-18 13:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 10:14 Hideyuki Yamashita
2018-12-18 13:02 ` Tiwei Bie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181218130205.GA2464@dpdk-tbie.sh.intel.com \
    --to=tiwei.bie@intel.com \
    --cc=dev@dpdk.org \
    --cc=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=yamashita.hideyuki@po.ntt-tx.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).