From: Hadar Hen Zion Date: Wed, 30 Jan 2013 23:07:05 +0000 (+0000) Subject: net/mlx4_en: Validate VLAN IDs provided in ethtool flow steering rules X-Git-Tag: v5.15~20710^2~198^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69d7126b7fef09beaa4b7c103ec2a5bd8c8b2666;p=platform%2Fkernel%2Flinux-starfive.git net/mlx4_en: Validate VLAN IDs provided in ethtool flow steering rules 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 Signed-off-by: Amir Vadai Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 86afb5b..f33049f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c @@ -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;