linux-stable/drivers/net
Ido Schimmel e44fe4d2a8 spectrum: Reference count VLAN entries
[ Upstream commit b3529af6bb ]

One of the basic construct in the device is a port-VLAN pair, which can
be bound to a FID or a RIF in order to direct packets to the bridge or
the router, respectively.

Since not all the netdevs are configured with a VLAN (e.g., sw1p1 vs.
sw1p1.10), VID 1 is used to represent these and thus this VID can be
used by both upper devices of mlxsw ports and by the driver itself.

However, this VID is not reference counted and therefore might be freed
prematurely, which can result in various WARNINGs. For example:

$ ip link add name br0 type bridge vlan_filtering 1
$ teamd -t team0 -d -c '{"runner": {"name": "lacp"}}'
$ ip link set dev team0 master br0
$ ip link set dev enp1s0np1 master team0
$ ip address add 192.0.2.1/24 dev enp1s0np1

The enslavement to team0 will fail because team0 already has an upper
and thus vlan_vids_del_by_dev() will be executed as part of team's error
path which will delete VID 1 from enp1s0np1 (added by br0 as PVID). The
WARNING will be generated when the driver will realize it can't find VID
1 on the port and bind it to a RIF.

Fix this by adding a reference count to the VLAN entries on the port, in
a similar fashion to the reference counting used by the corresponding
'vlan_vid_info' structure in the 8021q driver.

Fixes: c57529e1d5 ("mlxsw: spectrum: Replace vPorts with Port-VLAN")
Reported-by: Tal Bar <talb@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Tested-by: Tal Bar <talb@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-30 07:52:07 +02:00
..
appletalk License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
arcnet License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bonding bonding: send learning packets for vlans on slave 2018-05-19 10:20:26 +02:00
caif License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
can can: hi311x: Work around TX complete interrupt erratum 2018-05-16 10:10:28 +02:00
cris License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dsa net: dsa: mv88e6xxx: Unregister MDIO bus on error path 2018-02-25 11:08:00 +01:00
ethernet spectrum: Reference count VLAN entries 2018-05-30 07:52:07 +02:00
fddi License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fjes
hamradio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hippi hippi: Fix a Fix a possible sleep-in-atomic bug in rr_close 2018-02-25 11:08:04 +01:00
hyperv hv_netvsc: Fix net device attach on older Windows hosts 2018-05-25 16:17:30 +02:00
ieee802154 net: ieee802154: adf7242: Fix bug if defined DEBUG 2018-03-19 08:42:49 +01:00
ipvlan ipvlan: add L2 check for packets arriving via virtual devices 2018-03-19 08:42:56 +01:00
phy net: phy: Tell caller result of phy_change() 2018-03-31 18:10:39 +02:00
plip
ppp pppoe: check sockaddr length in pppoe_connect() 2018-04-29 11:33:12 +02:00
slip slip: Check if rstate is initialized before uncompressing 2018-04-19 08:56:16 +02:00
team team: fix netconsole setup over team 2018-04-29 11:33:12 +02:00
usb r8152: fix tx packets accounting 2018-05-30 07:52:05 +02:00
vmxnet3 vmxnet3: use DMA memory barriers where required 2018-05-25 16:17:25 +02:00
wan hdlc_ppp: carrier detect ok, don't turn off negotiation 2018-03-08 22:41:08 -08:00
wimax License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
wireless iwlwifi: mvm: always init rs with 20mhz bandwidth rates 2018-05-30 07:51:57 +02:00
xen-netback xen-netfront, xen-netback: Use correct minimum MTU values 2017-10-16 16:00:44 -04:00
dummy.c
eql.c
geneve.c net: don't call update_pmtu unconditionally 2018-05-09 09:51:48 +02:00
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c macsec: fix memory leaks when skb_to_sgvec fails 2017-10-11 14:07:20 -07:00
macvlan.c macvlan: fix use-after-free in macvlan_common_newlink() 2018-05-30 07:52:02 +02:00
macvtap.c tap: reference to KVA of an unloaded module causes kernel panic 2017-10-28 19:17:21 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c net: accept UFO datagrams from tuntap and packet 2017-12-17 15:07:58 +01:00
tun.c tuntap: disable preemption during XDP processing 2018-03-08 22:41:18 -08:00
veth.c veth: set peer GSO values 2018-03-19 08:42:54 +01:00
virtio_net.c virtio_net: fix XDP code path in receive_small() 2018-05-30 07:52:00 +02:00
vrf.c vrf: Fix use after free and double free in vrf_finish_output 2018-04-12 12:32:24 +02:00
vsockmon.c
vxlan.c net: don't call update_pmtu unconditionally 2018-05-09 09:51:48 +02:00
xen-netfront.c xen-netfront: Fix race between device setup and open 2018-04-26 11:02:17 +02:00