[dpdk-dev] [PATCH] vhost: delete freeing mac_addrs in eth_dev_close

Tiwei Bie tiwei.bie at intel.com
Tue Dec 18 14:02:05 CET 2018


> 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 at 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 at 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 at 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
> 
> 
> 


More information about the dev mailing list