Skip to content

Commit ea2a1cf

Browse files
ivecerakuba-moo
authored andcommitted
i40e: Fix VF MAC filter removal
Commit 73d9629 ("i40e: Do not allow untrusted VF to remove administratively set MAC") fixed an issue where untrusted VF was allowed to remove its own MAC address although this was assigned administratively from PF. Unfortunately the introduced check is wrong because it causes that MAC filters for other MAC addresses including multi-cast ones are not removed. <snip> if (ether_addr_equal(addr, vf->default_lan_addr.addr) && i40e_can_vf_change_mac(vf)) was_unimac_deleted = true; else continue; if (i40e_del_mac_filter(vsi, al->list[i].addr)) { ... </snip> The else path with `continue` effectively skips any MAC filter removal except one for primary MAC addr when VF is allowed to do so. Fix the check condition so the `continue` is only done for primary MAC address. Fixes: 73d9629 ("i40e: Do not allow untrusted VF to remove administratively set MAC") Signed-off-by: Ivan Vecera <[email protected]> Reviewed-by: Michal Schmidt <[email protected]> Reviewed-by: Brett Creeley <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0323b25 commit ea2a1cf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,11 +3137,12 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
31373137
/* Allow to delete VF primary MAC only if it was not set
31383138
* administratively by PF or if VF is trusted.
31393139
*/
3140-
if (ether_addr_equal(addr, vf->default_lan_addr.addr) &&
3141-
i40e_can_vf_change_mac(vf))
3142-
was_unimac_deleted = true;
3143-
else
3144-
continue;
3140+
if (ether_addr_equal(addr, vf->default_lan_addr.addr)) {
3141+
if (i40e_can_vf_change_mac(vf))
3142+
was_unimac_deleted = true;
3143+
else
3144+
continue;
3145+
}
31453146

31463147
if (i40e_del_mac_filter(vsi, al->list[i].addr)) {
31473148
ret = -EINVAL;

0 commit comments

Comments
 (0)