Skip to content

Commit

Permalink
net/mlx4_en: Validate VLAN IDs provided in ethtool flow steering rules
Browse files Browse the repository at this point in the history
When attaching flow steering rules via Ethtool accept only valid vlans IDs e.g
in the range: [0,4095].

Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Hadar Hen Zion authored and David S. Miller committed Jan 31, 2013
1 parent f90a367 commit 69d7126
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,10 @@ static int mlx4_en_validate_flow(struct net_device *dev,
!(cmd->fs.m_ext.vlan_tci == 0 ||
cmd->fs.m_ext.vlan_tci == cpu_to_be16(0xfff)))
return -EINVAL;
if (cmd->fs.m_ext.vlan_tci) {
if (be16_to_cpu(cmd->fs.h_ext.vlan_tci) >= VLAN_N_VID)
return -EINVAL;
}
}

return 0;
Expand Down

0 comments on commit 69d7126

Please sign in to comment.