On Tue, Oct 27, 2026 at 10:51:35AM +0000, Anurag Mandal wrote:
> ice_release_vsi() relies on ice_remove_all_mac_vlan_filters() to free
> the MAC and VLAN filter entries. That function returns early when the
> VSI has no MAC filter, or when removing a filter from hardware fails,
> leaving entries in the lists. The VSI is then freed with them still
> allocated.
>
> Free any entries left in the lists before freeing the VSI.
>
> Fixes: e0dcf94a0d7f ("net/ice: support VLAN ops")
Cc: [email protected]
>
> Signed-off-by: Anurag Mandal <[email protected]>
> ---
> drivers/net/intel/ice/ice_ethdev.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
Acked-by: Bruce Richardson <[email protected]>
>
> diff --git a/drivers/net/intel/ice/ice_ethdev.c
> b/drivers/net/intel/ice/ice_ethdev.c
> index 73fa016066..90e3663287 100644
> --- a/drivers/net/intel/ice/ice_ethdev.c
> +++ b/drivers/net/intel/ice/ice_ethdev.c
> @@ -2931,6 +2931,9 @@ ice_release_vsi(struct ice_vsi *vsi)
> {
> struct ice_hw *hw;
> struct ice_vsi_ctx vsi_ctx;
> + struct ice_mac_filter *m_f;
> + struct ice_vlan_filter *v_f;
> + void *temp;
> int ret, error = 0;
>
> if (!vsi)
> @@ -2940,6 +2943,12 @@ ice_release_vsi(struct ice_vsi *vsi)
>
> ice_remove_all_mac_vlan_filters(vsi);
>
> + /* filters whose HW removal failed or was skipped are still listed */
> + RTE_TAILQ_FOREACH_SAFE(m_f, &vsi->mac_list, next, temp)
> + rte_free(m_f);
> + RTE_TAILQ_FOREACH_SAFE(v_f, &vsi->vlan_list, next, temp)
> + rte_free(v_f);
> +
> memset(&vsi_ctx, 0, sizeof(vsi_ctx));
>
> vsi_ctx.vsi_num = vsi->vsi_id;
> --
> 2.25.1
>