[PATCH v4 8/9] net/ice: fix memory leak in DCF QoS bandwidth config

Medvedkin, Vladimir vladimir.medvedkin at intel.com
Wed Feb 11 16:56:38 CET 2026


Acked-by: Vladimir Medvedkin <vladimir.medvedkin at intel.com>

On 2/11/2026 1:49 PM, Anatoly Burakov wrote:
> Currently, when committing DCF QoS bandwidth configuration for VFs and TCs,
> we are using rte_zmalloc followed by copying the data to persistent storage
> and then discarding the temporary buffers. This is not needed as these
> temporary buffers are not being stored anywhere, so replace them with
> regular calloc. However, because the original code was missing a
> corresponding `rte_free()` call for these temporary allocations, this
> also fixes a memory leak.
>
> Fixes: 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
> Cc: stable at dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
> ---
>   drivers/net/intel/ice/ice_dcf_sched.c | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/intel/ice/ice_dcf_sched.c b/drivers/net/intel/ice/ice_dcf_sched.c
> index 2832d223d1..645f1373f4 100644
> --- a/drivers/net/intel/ice/ice_dcf_sched.c
> +++ b/drivers/net/intel/ice/ice_dcf_sched.c
> @@ -746,8 +746,8 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
>   {
>   	struct ice_dcf_adapter *adapter = dev->data->dev_private;
>   	struct ice_dcf_hw *hw = &adapter->real_hw;
> -	struct virtchnl_dcf_bw_cfg_list *vf_bw;
> -	struct virtchnl_dcf_bw_cfg_list *tc_bw;
> +	struct virtchnl_dcf_bw_cfg_list *vf_bw = NULL;
> +	struct virtchnl_dcf_bw_cfg_list *tc_bw = NULL;
>   	struct ice_dcf_tm_node_list *vsi_list = &hw->tm_conf.vsi_list;
>   	struct rte_tm_shaper_params *profile;
>   	struct ice_dcf_tm_node *tm_node;
> @@ -770,12 +770,12 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
>   	size = sizeof(struct virtchnl_dcf_bw_cfg_list) +
>   		sizeof(struct virtchnl_dcf_bw_cfg) *
>   		(hw->tm_conf.nb_tc_node - 1);
> -	vf_bw = rte_zmalloc("vf_bw", size, 0);
> +	vf_bw = calloc(1, size);
>   	if (!vf_bw) {
>   		ret_val = ICE_ERR_NO_MEMORY;
>   		goto fail_clear;
>   	}
> -	tc_bw = rte_zmalloc("tc_bw", size, 0);
> +	tc_bw = calloc(1, size);
>   	if (!tc_bw) {
>   		ret_val = ICE_ERR_NO_MEMORY;
>   		goto fail_clear;
> @@ -875,6 +875,11 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
>   	return ret_val;
>   
>   fail_clear:
> +	if (vf_bw != NULL)
> +		free(vf_bw);
> +	if (tc_bw != NULL)
> +		free(tc_bw);
> +
>   	/* clear all the traffic manager configuration */
>   	if (clear_on_fail) {
>   		ice_dcf_tm_conf_uninit(dev);

-- 
Regards,
Vladimir



More information about the dev mailing list