Skip to contentSkip to conversation

igb: Fix removal of unicast MAC filters of VFs

PATCH New Karen Sornek 2 participants 2 messages Aug 31, 2021 – Nov 26, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 neccessary and working VF's MAC filer.

Fixes 1b8b062a99dc ("igb: add VF trust infrastructure")
---
 drivers/net/ethernet/intel/igb/igb_main.c | 28 +++++++++++------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +14 -14
index 842b50cc9..98e977fe5 100644
@@ -7648,6 +7648,20 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
 	struct vf_mac_filter *entry = NULL;
 	int ret = 0;
 
+	if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) &&
+	    !vf_data->trusted) {
+		dev_warn(&pdev->dev,
+			 "VF %d requested MAC filter but is administratively denied\n",
+			  vf);
+		return -EINVAL;
+	}
+	if (!is_valid_ether_addr(addr)) {
+		dev_warn(&pdev->dev,
+			 "VF %d attempted to set invalid MAC filter\n",
+			  vf);
+		return -EINVAL;
+	}
+
 	switch (info) {
 	case E1000_VF_MAC_FILTER_CLR:
 		/* 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,
 		}
 		break;
 	case E1000_VF_MAC_FILTER_ADD:
-		if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) &&
-		    !vf_data->trusted) {
-			dev_warn(&pdev->dev,
-				 "VF %d requested MAC filter but is administratively denied\n",
-				 vf);
-			return -EINVAL;
-		}
-		if (!is_valid_ether_addr(addr)) {
-			dev_warn(&pdev->dev,
-				 "VF %d attempted to set invalid MAC filter\n",
-				 vf);
-			return -EINVAL;
-		}
-
 		/* try to find empty slot in the list */
 		list_for_each(pos, &adapter->vf_macs.l) {
 			entry = list_entry(pos, struct vf_mac_filter, l);
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/1 igb: Fix removal of unicast MAC filters of VFs

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

Quoted 26 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Karen Sornek
Sent: wtorek, 31 sierpnia 2021 13:17
To: intel-wired-lan at lists.osuosl.org
Cc: Sornek, Karen <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v1] 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 neccessary and working VF's MAC filer.

Fixes 1b8b062a99dc ("igb: add VF trust infrastructure")
---
 drivers/net/ethernet/intel/igb/igb_main.c | 28 +++++++++++------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +0 -0
index 842b50cc9..98e977fe5 100644