Skip to contentSkip to conversation

iavf: Fix ping is lost after untrusted VF had tried to change MAC

PATCH New Mateusz Palczewski 2 participants 2 messages Jun 28, 2021 – Jul 22, 2021 6 messages not in the archive

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

PATCH v2 1/1 iavf: Fix ping is lost after untrusted VF had tried to change MAC

From: Sylwester Dziedziuch <[email protected]>

Make changes to MAC address dependent on the response of PF. Disallow changes to hw mac address and mac filter from untrusted VF, thanks to that ping is not lost if VF tries to change MAC. Add a new field in iavf_mac_filter, to indicate whether there was response from PF for given filter. Based on this field pass or discard the filter.
If untrusted VF tried to change it's address, it's not changed. Still filter was changed, because of that ping couldn't go through.

Fixes c5c922b3e09b ("iavf: fix MAC address setting for VFs when filter is rejected")

---
v2: Fixed function names in comments

---
 drivers/net/ethernet/intel/iavf/iavf.h        |  1 +
 drivers/net/ethernet/intel/iavf/iavf_main.c   |  1 +
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   | 47 ++++++++++++++++++-
 3 files changed, 47 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +1 -0
index 9ccb88e..b79d02f 100644
@@ -137,6 +137,7 @@ struct iavf_q_vector {
 struct iavf_mac_filter {
 	struct list_head list;
 	u8 macaddr[ETH_ALEN];
+	bool is_new_mac;	/* filter is new, wait for PF decision */
 	bool remove;		/* filter needs to be removed */
 	bool add;		/* filter needs to be added */
 };
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -0
index d64e256..c9d9bf9 100644
@@ -797,6 +797,7 @@ struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter,
 
 		list_add_tail(&f->list, &adapter->mac_filter_list);
 		f->add = true;
+		f->is_new_mac = true;
 		adapter->aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER;
 	} else {
 		f->remove = false;
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +45 -2

67 lines not on this page · raw message

Signature · 1 line
2.17.1

A message that is not in the archive (sent off-list or not yet received): BN6PR11MB392398056E8C2C4942BEC4038C189@BN6PR11MB3923.namprd11.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): BYAPR11MB33678799BFFC6AEEEE9EDDCCFC139@BYAPR11MB3367.namprd11.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): BYAPR11MB336713E82D26AEEA08B4A2FAFC139@BYAPR11MB3367.namprd11.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): BYAPR11MB3367955F8C5E5474683E46F7FCE49@BYAPR11MB3367.namprd11.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): BYAPR11MB3367A5CD95A08A740B0D3843FCE49@BYAPR11MB3367.namprd11.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): BYAPR11MB3367EF5CEE54FC6415541454FCE49@BYAPR11MB3367.namprd11.prod.outlook.com

#7 lore raw

PATCH v2 1/1 iavf: Fix ping is lost after untrusted VF had tried to change MAC

Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: Monday, June 28, 2021 5:41 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Dziedziuch, SylwesterX <[email protected]>; Patynowski, PrzemyslawX <[email protected]>; Palczewski, Mateusz <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2] iavf: Fix ping is lost after untrusted VF had tried to change MAC

Quoted 8 lines

From: Sylwester Dziedziuch <[email protected]>

Make changes to MAC address dependent on the response of PF. Disallow changes to hw mac address and mac filter from untrusted VF, thanks to that ping is not lost if VF tries to change MAC. Add a new field in iavf_mac_filter, to indicate whether there was response from PF for given filter. Based on this field pass or discard the

filter.

Quoted 10 lines

If untrusted VF tried to change it's address, it's not changed. Still filter was changed, because of that ping couldn't go through.

Fixes c5c922b3e09b ("iavf: fix MAC address setting for VFs when

filter is
rejected")
Signed-off-by: Przemyslaw Patynowski
<[email protected]>

Quoted 8 lines

---
v2: Fixed function names in comments

---
 drivers/net/ethernet/intel/iavf/iavf.h        |  1 +
 drivers/net/ethernet/intel/iavf/iavf_main.c   |  1 +
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   | 47 ++++++++++++++++++-
 3 files changed, 47 insertions(+), 2 deletions(-)
Quoted 1 line

at Intel