[PATCH v4 9/9] net/ice: fix memory leak in FDIR flow parsing

Medvedkin, Vladimir vladimir.medvedkin at intel.com
Wed Feb 11 17:06:39 CET 2026


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

On 2/11/2026 1:49 PM, Anatoly Burakov wrote:
> Currently, RAW pattern parsing will cause a `pkt_buf` buffer to be
> allocated to store parsed RAW pattern bytes. All error paths handle the
> deallocation correctly, and the buffer will then be passed to FDIR filter
> create function which also handles the presence of the buffer correctly,
> and it is also freed correctly in destroy function.
>
> However, rte_flow_validate will go through the same code path, but will not
> call FDIR create/destroy nor even store the pointer, because `meta`
> variable inside the flow parsing function will be set to NULL, which will
> cause this memory to be leaked (and memset(0)-ed next time we try to
> create/validate another flow).
>
> Fix it by freeing the `pkt_buf` when `meta` is NULL.
>
> Fixes: 25be39cc1760 ("net/ice: enable protocol agnostic flow offloading in FDIR")
> Cc: stable at dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
> ---
>   drivers/net/intel/ice/ice_fdir_filter.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
> index f7730ec6ab..5abdcbac7f 100644
> --- a/drivers/net/intel/ice/ice_fdir_filter.c
> +++ b/drivers/net/intel/ice/ice_fdir_filter.c
> @@ -2497,8 +2497,12 @@ ice_fdir_parse(struct ice_adapter *ad,
>   	if (ret)
>   		goto error;
>   
> -	if (meta)
> +	/* if meta is NULL we're validating so the flow won't be stored */
> +	if (meta) {
>   		*meta = filter;
> +	} else if (filter->pkt_buf != NULL) {
> +		rte_free(filter->pkt_buf);
> +	}
>   
>   	rte_free(item);
>   	return ret;

-- 
Regards,
Vladimir



More information about the dev mailing list