Skip to content

Commit

Permalink
net/ice/base: cleanup filter list on error
Browse files Browse the repository at this point in the history
[ upstream commit 34ede45 ]

When ice_remove_vsi_lkup_fltr is called, by calling
ice_add_to_vsi_fltr_list local copy of vsi filter list
is created. If any issues during creation of vsi filter
list occurs it up for the caller to free already
allocated memory. This patch ensures proper memory
deallocation in these cases.

Fixes: c7dd159 ("net/ice/base: add virtual switch code")

Signed-off-by: Robert Malz <robertx.malz@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
  • Loading branch information
qzhan16 authored and steevenlee committed May 8, 2021
1 parent 8d88d38 commit 0d32ae0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ice/base/ice_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -5602,7 +5602,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle,
&remove_list_head);
ice_release_lock(rule_lock);
if (status)
return;
goto free_fltr_list;

switch (lkup) {
case ICE_SW_LKUP_MAC:
Expand Down Expand Up @@ -5630,6 +5630,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle,
break;
}

free_fltr_list:
LIST_FOR_EACH_ENTRY_SAFE(fm_entry, tmp, &remove_list_head,
ice_fltr_list_entry, list_entry) {
LIST_DEL(&fm_entry->list_entry);
Expand Down

0 comments on commit 0d32ae0

Please sign in to comment.