i40e: fix accessing vsi->active_filters without holding lock
[ Upstream commit 8485d093b076e59baff424552e8aecfc5bd2d261 ]
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: 278e7d0b9d
("i40e: store MAC/VLAN filters in a hash with the MAC Address as key")
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
01125379e2
commit
59fba01b6c
@ -13463,15 +13463,15 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)
|
|||||||
vsi->id = ctxt.vsi_number;
|
vsi->id = ctxt.vsi_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
vsi->active_filters = 0;
|
|
||||||
clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
|
|
||||||
spin_lock_bh(&vsi->mac_filter_hash_lock);
|
spin_lock_bh(&vsi->mac_filter_hash_lock);
|
||||||
|
vsi->active_filters = 0;
|
||||||
/* If macvlan filters already exist, force them to get loaded */
|
/* If macvlan filters already exist, force them to get loaded */
|
||||||
hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
|
hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
|
||||||
f->state = I40E_FILTER_NEW;
|
f->state = I40E_FILTER_NEW;
|
||||||
f_count++;
|
f_count++;
|
||||||
}
|
}
|
||||||
spin_unlock_bh(&vsi->mac_filter_hash_lock);
|
spin_unlock_bh(&vsi->mac_filter_hash_lock);
|
||||||
|
clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
|
||||||
|
|
||||||
if (f_count) {
|
if (f_count) {
|
||||||
vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED;
|
vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED;
|
||||||
|
Loading…
Reference in New Issue
Block a user