aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorMatthew Vick <matthew.vick@intel.com>2015-01-26 21:33:26 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-02-05 22:41:50 -0500
commit33a44c2873ba64c54d11a9364b6b43271761d245 (patch)
treefdd1878bc976f9d0172c13e822070cc1aa80efe0 /drivers/net/ethernet
parent2ca292d968ef20cb04f31192d1f626bd8d782960 (diff)
fm10k: Validate VLAN ID in fm10k_update_xc_addr_pf
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>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_pf.c7
1 files 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 275423d4f777..7e4711958e46 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,
330 struct fm10k_mac_update mac_update; 330 struct fm10k_mac_update mac_update;
331 u32 msg[5]; 331 u32 msg[5];
332 332
333 /* if glort is not valid return error */ 333 /* if glort or vlan are not valid return error */
334 if (!fm10k_glort_valid_pf(hw, glort)) 334 if (!fm10k_glort_valid_pf(hw, glort) || vid >= FM10K_VLAN_TABLE_VID_MAX)
335 return FM10K_ERR_PARAM; 335 return FM10K_ERR_PARAM;
336 336
337 /* drop upper 4 bits of VLAN ID */
338 vid = (vid << 4) >> 4;
339
340 /* record fields */ 337 /* record fields */
341 mac_update.mac_lower = cpu_to_le32(((u32)mac[2] << 24) | 338 mac_update.mac_lower = cpu_to_le32(((u32)mac[2] << 24) |
342 ((u32)mac[3] << 16) | 339 ((u32)mac[3] << 16) |