]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum: Forbid linking to devices that have uppers
authorIdo Schimmel <idosch@mellanox.com>
Fri, 1 Sep 2017 08:52:31 +0000 (10:52 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Sep 2017 16:59:41 +0000 (09:59 -0700)
commit2661143fbe4754fb8a279aac3490f3426492c8ea
treeb5df6849c1a628c1c419dee6bdc8a90f4327a55e
parent375330bf59276827b536d49d5beebbcd2e2f420d
mlxsw: spectrum: Forbid linking to devices that have uppers

The mlxsw driver relies on NETDEV_CHANGEUPPER events to configure the
device in case a port is enslaved to a master netdev such as bridge or
bond.

Since the driver ignores events unrelated to its ports and their
uppers, it's possible to engineer situations in which the device's data
path differs from the kernel's.

One example to such a situation is when a port is enslaved to a bond
that is already enslaved to a bridge. When the bond was enslaved the
driver ignored the event - as the bond wasn't one of its uppers - and
therefore a bridge port instance isn't created in the device.

Until such configurations are supported forbid them by checking that the
upper device doesn't have uppers of its own.

Fixes: 0dac7b293e59 ("mlxsw: spectrum: Implement LAG port join/leave")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Nogah Frankel <nogahf@mellanox.com>
Tested-by: Nogah Frankel <nogahf@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
include/linux/netdevice.h
net/core/dev.c