Skip to content

Commit 8485d09

Browse files
aloktionanguy11
authored andcommitted
i40e: fix accessing vsi->active_filters without holding lock
Fix accessing vsi->active_filters without holding the mac_filter_hash_lock. Move vsi->active_filters = 0 inside critical section and move clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state) after the critical section to ensure the new filters from other threads can be added only after filters cleaning in the critical section is finished. Fixes: 278e7d0 ("i40e: store MAC/VLAN filters in a hash with the MAC Address as key") Signed-off-by: Aleksandr Loktionov <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 338469d commit 8485d09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14133,15 +14133,15 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)
1413314133
vsi->id = ctxt.vsi_number;
1413414134
}
1413514135

14136-
vsi->active_filters = 0;
14137-
clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
1413814136
spin_lock_bh(&vsi->mac_filter_hash_lock);
14137+
vsi->active_filters = 0;
1413914138
/* If macvlan filters already exist, force them to get loaded */
1414014139
hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
1414114140
f->state = I40E_FILTER_NEW;
1414214141
f_count++;
1414314142
}
1414414143
spin_unlock_bh(&vsi->mac_filter_hash_lock);
14144+
clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
1414514145

1414614146
if (f_count) {
1414714147
vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED;

0 commit comments

Comments
 (0)