Blob Blame History Raw
From: Jiri Slaby <jslaby@suse.cz>
Subject: mlxsw: spectrum: Forbid linking to devices that have uppers FIX
References: stable-fixes
Patch-mainline: never, incorrect stable backport

This is a fix for a stable patch:
  patches.kernel.org/4.12.14-034-mlxsw-spectrum-Forbid-linking-to-devices-that.patch
which is in upstream as 25cc72a33835ed8a6f53180a822cadab855852ac.

The stable backport incorrectly patched mlxsw_sp_netdevice_bridge_event
instead of mlxsw_sp_netdevice_vport_event, so fix it up here.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -4276,10 +4276,6 @@ static int mlxsw_sp_netdevice_bridge_eve
 		if (is_vlan_dev(upper_dev) &&
 		    br_dev != mlxsw_sp->master_bridge.dev)
 			return -EINVAL;
-		if (!info->linking)
-			break;
-		if (netdev_has_any_upper_dev(upper_dev))
-			return -EINVAL;
 		break;
 	case NETDEV_CHANGEUPPER:
 		upper_dev = info->upper_dev;
@@ -4527,6 +4523,8 @@ static int mlxsw_sp_netdevice_vport_even
 			return -EINVAL;
 		if (!info->linking)
 			break;
+		if (netdev_has_any_upper_dev(upper_dev))
+			return -EINVAL;
 		/* We can't have multiple VLAN interfaces configured on
 		 * the same port and being members in the same bridge.
 		 */