>From 508d912b5f6b56c3f588b1bf28d3caed9e30db1b Mon Sep 17 00:00:00 2001 From: Vladimir Oltean Date: Fri, 11 Apr 2025 21:38:52 +0300 Subject: [PATCH] net: dsa: mv88e6xxx: fix -ENOENT while deleting user port VLANs Russell King reports that on the ZII dev rev B, deleting a bridge VLAN from a user port fails with -ENOENT: https://lore.kernel.org/netdev/Z_lQXNP0s5-IiJzd@shell.armlinux.org.uk/ This comes from mv88e6xxx_port_vlan_leave() -> mv88e6xxx_mst_put(), which tries to find an MST entry in &chip->msts associated with the SID, but fails and returns -ENOENT as such. But we know that this chip does not support MST at all, so that is not surprising. The question is why does the guard in mv88e6xxx_mst_put() not exit early: if (!sid) return 0; And the answer seems to be simple: the sid comes from vlan.sid which supposedly was previously populated by mv88e6xxx_vtu_loadpurge(). But some chip->info->ops->vtu_loadpurge() implementations do not look at vlan.sid at all, for example see mv88e6185_g1_vtu_loadpurge(). It was probably intended for the on-stack struct mv88e6xxx_vtu_entry vlan entry to be zero-initialized, because currently it looks like we're looking at a garbage sid which is just residual stack memory. So zero-initialize this to avoid MST operations on switches which don't support MST. Fixes: acaf4d2e36b3 ("net: dsa: mv88e6xxx: MST Offloading") Signed-off-by: Vladimir Oltean --- drivers/net/dsa/mv88e6xxx/chip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 29a89ab4b789..c94c228434fc 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -2706,7 +2706,7 @@ static int mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, static int mv88e6xxx_port_vlan_leave(struct mv88e6xxx_chip *chip, int port, u16 vid) { - struct mv88e6xxx_vtu_entry vlan; + struct mv88e6xxx_vtu_entry vlan = {}; int i, err; if (!vid) -- 2.34.1