]> www.infradead.org Git - users/jedix/linux-maple.git/commit
net/mlx5e: Block entering switchdev mode with ns inconsistency
authorGavin Li <gavinl@nvidia.com>
Thu, 9 Feb 2023 10:48:52 +0000 (12:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2023 10:49:08 +0000 (12:49 +0200)
commit93260bd809e0ce44fda463ebc590376e24d8cc11
treea791e7384ca3b6a01764ebb09de5364cf33e7a68
parent3169140ee294351d35162ecea05251add75e0377
net/mlx5e: Block entering switchdev mode with ns inconsistency

[ Upstream commit 662404b24a4c4d839839ed25e3097571f5938b9b ]

Upon entering switchdev mode, VF/SF representors are spawned in the
devlink instance's net namespace, whereas the PF net device transforms
into the uplink representor, remaining in the net namespace the PF net
device was in. Therefore, if a PF net device's namespace is different from
its parent devlink net namespace, entering switchdev mode can create an
illegal situation where all representors sharing the same core device
are NOT in the same net namespace.

To avoid this issue, block entering switchdev mode for devices whose child
netdev net namespace has diverged from the parent devlink's.

Fixes: 7768d1971de6 ("net/mlx5: E-Switch, Add control for encapsulation")
Signed-off-by: Gavin Li <gavinl@nvidia.com>
Reviewed-by: Gavi Teitz <gavi@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c