Skip to content

Commit 158daed

Browse files
sassmannJeff Kirsher
authored andcommitted
i40e: fix mac filter delete when setting mac address
A previous commit moved the ether_addr_copy() in i40e_set_mac() before the mac filter del/add to avoid a race. However it wasn't taken into account that this alters the mac address being handed to i40e_del_mac_filter(). Also changed i40e_add_mac_filter() to operate on netdev->dev_addr, hopefully that makes the code easier to read. Fixes: 458867b ("i40e: don't remove netdev->dev_addr when syncing uc list") Signed-off-by: Stefan Assmann <[email protected]> Tested-by: Andrew Bowers <[email protected]> Acked-by: Jacob Keller <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent ee28b30 commit 158daed

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,17 +1543,17 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
15431543
netdev_info(netdev, "set new mac address %pM\n", addr->sa_data);
15441544

15451545
/* Copy the address first, so that we avoid a possible race with
1546-
* .set_rx_mode(). If we copy after changing the address in the filter
1547-
* list, we might open ourselves to a narrow race window where
1548-
* .set_rx_mode could delete our dev_addr filter and prevent traffic
1549-
* from passing.
1546+
* .set_rx_mode().
1547+
* - Remove old address from MAC filter
1548+
* - Copy new address
1549+
* - Add new address to MAC filter
15501550
*/
1551-
ether_addr_copy(netdev->dev_addr, addr->sa_data);
1552-
15531551
spin_lock_bh(&vsi->mac_filter_hash_lock);
15541552
i40e_del_mac_filter(vsi, netdev->dev_addr);
1555-
i40e_add_mac_filter(vsi, addr->sa_data);
1553+
ether_addr_copy(netdev->dev_addr, addr->sa_data);
1554+
i40e_add_mac_filter(vsi, netdev->dev_addr);
15561555
spin_unlock_bh(&vsi->mac_filter_hash_lock);
1556+
15571557
if (vsi->type == I40E_VSI_MAIN) {
15581558
i40e_status ret;
15591559

0 commit comments

Comments
 (0)