On Tue, Oct 27, 2026 at 10:51:37AM +0000, Anurag Mandal wrote:
> ice_acl_prof_init() allocates a flow segment to add the ACL profiles,
> but only frees it on the error path. ice_flow_add_prof() copies the
> segments, so the buffer is no longer needed once the profiles are
> added, and it leaks on every ACL engine init.
>
> Free it on success as well.
>
> Fixes: 40d466fa9f76 ("net/ice: support ACL filter in DCF")
>
> Signed-off-by: Anurag Mandal <[email protected]>
> ---
> drivers/net/intel/ice/ice_acl_filter.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/intel/ice/ice_acl_filter.c
> b/drivers/net/intel/ice/ice_acl_filter.c
> index 21b48e1009..d49e514d69 100644
> --- a/drivers/net/intel/ice/ice_acl_filter.c
> +++ b/drivers/net/intel/ice/ice_acl_filter.c
> @@ -308,6 +308,7 @@ ice_acl_prof_init(struct ice_pf *pf)
> goto err_assoc_prof;
> }
> }
> + ice_free(hw, seg);
> return 0;
>
While this change fixes the bug, I see no reason why we can't avoid the bug
completely by changing seg to be allocated on the stack rather than
dynamically allocated. Define and zero-init as:
struct ice_flow_seg_info seg = {0};
And then the memory management issues disappear as its just a local
temporary buffer.
What do you think?