net/mlx5e: Set uplink rep as NETNS_LOCAL
authorGavin Li <gavinl@nvidia.com>
Fri, 25 Nov 2022 02:15:40 +0000 (04:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2023 10:47:47 +0000 (12:47 +0200)
commit2b0f1716c1070d1d147e586f97be40ab8ece4250
tree7154780e3e902c158be58af09d02a52b37ffee17
parent54869daa6a437887614274f65298ba44a3fac63a
net/mlx5e: Set uplink rep as NETNS_LOCAL

[ Upstream commit c83172b0639c8a005c0dd3b36252dc22ddd9f19c ]

Previously, NETNS_LOCAL was not set for uplink representors, inconsistent
with VF representors, and allowed the uplink representor to be moved
between net namespaces and separated from the VF representors it shares
the core device with. Such usage would break the isolation model of
namespaces, as devices in different namespaces would have access to
shared memory.

To solve this issue, set NETNS_LOCAL for uplink representors if eswitch is
in switchdev mode.

Fixes: 7a9fb35e8c3a ("net/mlx5e: Do not reload ethernet ports when changing eswitch mode")
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/en_main.c