[dpdk-stable] [PATCH] net/bonding: fix memory leak on closing device

Min Hu (Connor) humin29 at huawei.com
Wed Sep 15 08:58:35 CEST 2021


Hi, dapengx,
	Why not free internals->kvlist at the end of "bond_ethdev_configure" ? 
Does it call some bugs?

在 2021/9/15 13:08, dapengx.yu at intel.com 写道:
> From: Dapeng Yu <dapengx.yu at intel.com>
> 
> If the bond device was created by vdev mode, the kvlist was not free
> after the bond device was closed.
> 
> This patch fixes it.
> 
> Fixes: 144dc4739975 ("net/bonding: fix leak on remove")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Dapeng Yu <dapengx.yu at intel.com>
> ---
>   drivers/net/bonding/rte_eth_bond_pmd.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index a6755661c4..2e96b850fb 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -2163,6 +2163,9 @@ bond_ethdev_close(struct rte_eth_dev *dev)
>   	 */
>   	rte_mempool_free(internals->mode6.mempool);
>   
> +	if (internals->kvlist != NULL)
> +		rte_kvargs_free(internals->kvlist);
> +
>   	return 0;
>   }
>   
> @@ -3475,8 +3478,6 @@ bond_remove(struct rte_vdev_device *dev)
>   		ret = bond_ethdev_stop(eth_dev);
>   		bond_ethdev_close(eth_dev);
>   	}
> -	if (internals->kvlist != NULL)
> -		rte_kvargs_free(internals->kvlist);
>   	rte_eth_dev_release_port(eth_dev);
>   
>   	return ret;
> 


More information about the stable mailing list