Commit b7eeb527 authored by Robert Malz's avatar Robert Malz Committed by Tony Nguyen

ice: Cleanup fltr list in case of allocation issues

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: 80d144c9 ("ice: Refactor switch rule management structures and functions")
Signed-off-by: default avatarRobert Malz <robertx.malz@intel.com>
Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 31765519
...@@ -2624,7 +2624,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, ...@@ -2624,7 +2624,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle,
&remove_list_head); &remove_list_head);
mutex_unlock(rule_lock); mutex_unlock(rule_lock);
if (status) if (status)
return; goto free_fltr_list;
switch (lkup) { switch (lkup) {
case ICE_SW_LKUP_MAC: case ICE_SW_LKUP_MAC:
...@@ -2647,6 +2647,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, ...@@ -2647,6 +2647,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle,
break; break;
} }
free_fltr_list:
list_for_each_entry_safe(fm_entry, tmp, &remove_list_head, list_entry) { list_for_each_entry_safe(fm_entry, tmp, &remove_list_head, list_entry) {
list_del(&fm_entry->list_entry); list_del(&fm_entry->list_entry);
devm_kfree(ice_hw_to_dev(hw), fm_entry); devm_kfree(ice_hw_to_dev(hw), fm_entry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment