netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Matthew Vick <matthew.vick@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next v2 01/16] fm10k: Validate VLAN ID in fm10k_update_xc_addr_pf
Date: Thu,  5 Feb 2015 20:31:10 -0800	[thread overview]
Message-ID: <1423197085-32270-2-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1423197085-32270-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Matthew Vick <matthew.vick@intel.com>

Currently, fm10k_update_xc_addr_pf has an issue where it does not
properly drop the upper-most four bits of the VLAN ID due to type
promotion. Resolve the issue not by masking off the bits, but by
throwing an error if the VLAN ID is out-of-bounds.

Reported-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Matthew Vick <matthew.vick@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index 275423d..7e47119 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -330,13 +330,10 @@ static s32 fm10k_update_xc_addr_pf(struct fm10k_hw *hw, u16 glort,
 	struct fm10k_mac_update mac_update;
 	u32 msg[5];
 
-	/* if glort is not valid return error */
-	if (!fm10k_glort_valid_pf(hw, glort))
+	/* if glort or vlan are not valid return error */
+	if (!fm10k_glort_valid_pf(hw, glort) || vid >= FM10K_VLAN_TABLE_VID_MAX)
 		return FM10K_ERR_PARAM;
 
-	/* drop upper 4 bits of VLAN ID */
-	vid = (vid << 4) >> 4;
-
 	/* record fields */
 	mac_update.mac_lower = cpu_to_le32(((u32)mac[2] << 24) |
 						 ((u32)mac[3] << 16) |
-- 
1.9.3

  reply	other threads:[~2015-02-06  4:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06  4:31 [net-next v2 00/16][pull request] Intel Wired LAN Driver Updates 2015-02-05 Jeff Kirsher
2015-02-06  4:31 ` Jeff Kirsher [this message]
2015-02-06  4:31 ` [net-next v2 02/16] fm10k: Resolve compile warnings with W=1 Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 03/16] ixgbe: cleanup sparse errors in new ixgbe_x550.c file Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 04/16] ixgbe: allow multiple queues in SRIOV mode Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 05/16] ixgbevf: enable multiple queue support Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 06/16] ixgbevf: add RSS support for X550 Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 07/16] ixgbe: fix setting port VLAN Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 08/16] ixgbe: cleanup redundant default method set_rxpba Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 09/16] ixgbe: Cleanup probe to remove redundant attempt to ID PHY Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 10/16] ixgbe: add VXLAN offload support for X550 devices Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 11/16] ixgbevf: set vlan_features in a single write instead of several ORs Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 12/16] ixgbevf: Fix ordering of shutdown to correctly disable Rx and Tx Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 13/16] ixgbevf: Add code to check for Tx hang Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 14/16] ixgbevf: rewrite watchdog task to function similar to igbvf Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 15/16] ixgbevf: combine all of the tasks into a single service task Jeff Kirsher
2015-02-06  4:31 ` [net-next v2 16/16] ixgbe: add Tx anti spoofing support Jeff Kirsher
2015-02-08  6:49 ` [net-next v2 00/16][pull request] Intel Wired LAN Driver Updates 2015-02-05 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423197085-32270-2-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=jogreene@redhat.com \
    --cc=matthew.vick@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).