]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: mv88e6xxx: also read STU state in mv88e6250_g1_vtu_getnext
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Sat, 16 Jan 2021 02:39:35 +0000 (03:39 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 18 Jan 2021 21:04:28 +0000 (13:04 -0800)
commit40f07e3ed51b3c553590781c3953ed714fd2a296
tree5eb9c174da0599be10fea63730973c103b8ae480
parente62907f816a9953fb59c5ca5ad1bae37425959fc
net: dsa: mv88e6xxx: also read STU state in mv88e6250_g1_vtu_getnext

mv88e6xxx_port_vlan_join checks whether the VTU already contains an
entry for the given vid (via mv88e6xxx_vtu_getnext), and if so, merely
changes the relevant .member[] element and loads the updated entry
into the VTU.

However, at least for the mv88e6250, the on-stack struct
mv88e6xxx_vtu_entry vlan never has its .state[] array explicitly
initialized, neither in mv88e6xxx_port_vlan_join() nor inside the
getnext implementation. So the new entry has random garbage for the
STU bits, breaking VLAN filtering.

When the VTU entry is initially created, those bits are all zero, and
we should make sure to keep them that way when the entry is updated.

Fixes: 5a72aec4d522 (net: dsa: mv88e6xxx: Avoid VTU corruption on 6097)
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Tobias Waldekranz <tobias@waldekranz.com>
Tested-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/mv88e6xxx/global1_vtu.c