]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
mlxsw: spectrum_switchdev: Fix VLAN device deletion via ioctl
authorIdo Schimmel <idosch@mellanox.com>
Thu, 6 Dec 2018 17:44:53 +0000 (17:44 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commite23789cea22a07f236526a11f1db4c493eb6d7ef
tree08057845f74afe65cdad9e542187698ee089e10b
parent7ef123951a83810a887bd02299186ca394087058
mlxsw: spectrum_switchdev: Fix VLAN device deletion via ioctl

BugLink: https://bugs.launchpad.net/bugs/1837257
[ Upstream commit 993107fea5eefdfdfde1ca38d3f01f0bebf76e77 ]

When deleting a VLAN device using an ioctl the netdev is unregistered
before the VLAN filter is updated via ndo_vlan_rx_kill_vid(). It can
lead to a use-after-free in mlxsw in case the VLAN device is deleted
while being enslaved to a bridge.

The reason for the above is that when mlxsw receives the CHANGEUPPER
event, it wrongly assumes that the VLAN device is no longer its upper
and thus destroys the internal representation of the bridge port despite
the reference count being non-zero.

Fix this by checking if the VLAN device is our upper using its real
device. In net-next I'm going to remove this trick and instead make
mlxsw completely agnostic to the order of the events.

Fixes: c57529e1d5d8 ("mlxsw: spectrum: Replace vPorts with Port-VLAN")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c