diff options
author | Ido Schimmel <idosch@mellanox.com> | 2016-06-20 21:04:00 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-21 09:02:48 (GMT) |
commit | 59fe9b3f842751688d9ee180f673314190813be1 (patch) | |
tree | 93b02c54ba21c674aa9774bf6f776b51b3d33dd7 /drivers | |
parent | 80bedf1a62d65fb79eaaf030e75174886f1a794c (diff) | |
download | linux-59fe9b3f842751688d9ee180f673314190813be1.tar.xz |
mlxsw: spectrum: Sanitize port netdev upper devices
We currently only support the following upper devices for port netdevs:
1) Bridge
2) LAG (bond / team)
3) VLAN
Any other device is forbidden, so return an error.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 3d57008..b47e3fb 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3034,6 +3034,10 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *dev, switch (event) { case NETDEV_PRECHANGEUPPER: upper_dev = info->upper_dev; + if (!is_vlan_dev(upper_dev) && + !netif_is_lag_master(upper_dev) && + !netif_is_bridge_master(upper_dev)) + return -EINVAL; if (!info->master || !info->linking) break; /* HW limitation forbids to put ports to multiple bridges. */ @@ -3070,6 +3074,9 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *dev, else err = mlxsw_sp_port_lag_leave(mlxsw_sp_port, upper_dev); + } else { + err = -EINVAL; + WARN_ON(1); } break; } |