Skip to content

Commit 584af82

Browse files
ksornekanguy11
authored andcommitted
igb: Fix removal of unicast MAC filters of VFs
Move checking condition of VF MAC filter before clearing or adding MAC filter to VF to prevent potential blackout caused by removal of necessary and working VF's MAC filter. Fixes: 1b8b062 ("igb: add VF trust infrastructure") Signed-off-by: Karen Sornek <[email protected]> Tested-by: Konrad Jankowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 1d1c950 commit 584af82

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

drivers/net/ethernet/intel/igb/igb_main.c

+14-14
Original file line numberDiff line numberDiff line change
@@ -7648,6 +7648,20 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
76487648
struct vf_mac_filter *entry = NULL;
76497649
int ret = 0;
76507650

7651+
if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) &&
7652+
!vf_data->trusted) {
7653+
dev_warn(&pdev->dev,
7654+
"VF %d requested MAC filter but is administratively denied\n",
7655+
vf);
7656+
return -EINVAL;
7657+
}
7658+
if (!is_valid_ether_addr(addr)) {
7659+
dev_warn(&pdev->dev,
7660+
"VF %d attempted to set invalid MAC filter\n",
7661+
vf);
7662+
return -EINVAL;
7663+
}
7664+
76517665
switch (info) {
76527666
case E1000_VF_MAC_FILTER_CLR:
76537667
/* remove all unicast MAC filters related to the current VF */
@@ -7661,20 +7675,6 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
76617675
}
76627676
break;
76637677
case E1000_VF_MAC_FILTER_ADD:
7664-
if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) &&
7665-
!vf_data->trusted) {
7666-
dev_warn(&pdev->dev,
7667-
"VF %d requested MAC filter but is administratively denied\n",
7668-
vf);
7669-
return -EINVAL;
7670-
}
7671-
if (!is_valid_ether_addr(addr)) {
7672-
dev_warn(&pdev->dev,
7673-
"VF %d attempted to set invalid MAC filter\n",
7674-
vf);
7675-
return -EINVAL;
7676-
}
7677-
76787678
/* try to find empty slot in the list */
76797679
list_for_each(pos, &adapter->vf_macs.l) {
76807680
entry = list_entry(pos, struct vf_mac_filter, l);

0 commit comments

Comments
 (0)