[PART1,10/11] i40e: explicitly fail on extended MAC field for ethtool_rx_flow_spec

Submitted by Keller, Jacob E on Feb. 6, 2017, 10:39 p.m.

Details

Message ID 20170206223913.31525-1-jacob.e.keller@intel.com
State Accepted
Delegated to: Jeff Kirsher
Headers show

Commit Message

Keller, Jacob E Feb. 6, 2017, 10:39 p.m.
Although we will fail the filter later due to checking flow_type which
will have a bogus invalid type, it is possible future refactoring will
remove this hidden failure case. Avoid a possible issue in the future by
explicitly checking the flow type at the start.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Change-Id: Ia98eb26f7b93ccbe38c7141e8f203ef496fc6598
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bowers, AndrewX March 6, 2017, 5:53 p.m.
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 10/11] i40e: explicitly fail on
> extended MAC field for ethtool_rx_flow_spec
> 
> Although we will fail the filter later due to checking flow_type which will have
> a bogus invalid type, it is possible future refactoring will remove this hidden
> failure case. Avoid a possible issue in the future by explicitly checking the
> flow type at the start.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Change-Id: Ia98eb26f7b93ccbe38c7141e8f203ef496fc6598
> ---
>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 4 ++++
>  1 file changed, 4 insertions(+)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>

Patch hide | download patch | download mbox

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index cfe4db974c8e..da36621379cc 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2733,6 +2733,10 @@  static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
 
 	fsp = (struct ethtool_rx_flow_spec *)&cmd->fs;
 
+	/* Extended MAC field is not supported */
+	if (fsp->flow_type & FLOW_MAC_EXT)
+		return -EINVAL;
+
 	if (fsp->location >= (pf->hw.func_caps.fd_filters_best_effort +
 			      pf->hw.func_caps.fd_filters_guaranteed)) {
 		return -EINVAL;