[v2,45/66] net/ice/base: protect list add with lock

Message ID 20190611155221.2703-46-leyi.rong@intel.com
State Superseded, archived
Delegated to: Qi Zhang
Headers show
Series
  • shared code update
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Leyi Rong June 11, 2019, 3:52 p.m.
Function ice_add_rule_internal needs to call ice_create_pkt_fwd_rule
with lock held because it uses the LIST_ADD to modify the filter
rule list. It needs to be protected when modified.

Signed-off-by: Tarun Singh <tarun.k.singh@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 77bcf9aa8..cdecc39b0 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -2287,14 +2287,15 @@  ice_add_rule_internal(struct ice_hw *hw, u8 recp_id,
 
 	m_entry = ice_find_rule_entry(hw, recp_id, new_fltr);
 	if (!m_entry) {
-		ice_release_lock(rule_lock);
-		return ice_create_pkt_fwd_rule(hw, f_entry);
+		status = ice_create_pkt_fwd_rule(hw, f_entry);
+		goto exit_add_rule_internal;
 	}
 
 	cur_fltr = &m_entry->fltr_info;
 	status = ice_add_update_vsi_list(hw, m_entry, cur_fltr, new_fltr);
-	ice_release_lock(rule_lock);
 
+exit_add_rule_internal:
+	ice_release_lock(rule_lock);
 	return status;
 }