]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net: dsa: mv88e6xxx: Fix off-by-one in VTU devlink region size
authorTobias Waldekranz <tobias@waldekranz.com>
Wed, 21 Apr 2021 12:04:53 +0000 (14:04 +0200)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 24 May 2021 23:46:41 +0000 (17:46 -0600)
BugLink: https://bugs.launchpad.net/bugs/1929455
[ Upstream commit 281140a0a2ce4febf2c0ce5d29d0e7d961a826b1 ]

In the unlikely event of the VTU being loaded to the brim with 4k
entries, the last one was placed in the buffer, but the size reported
to devlink was off-by-one. Make sure that the final entry is available
to the caller.

Fixes: ca4d632aef03 ("net: dsa: mv88e6xxx: Export VTU as devlink region")
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/net/dsa/mv88e6xxx/devlink.c

index 21953d6d484c58ad52a23d3347a846077e3c29a2..ada7a38d4d313971a51376f013d6359eea8088f0 100644 (file)
@@ -678,7 +678,7 @@ static int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds,
                                sizeof(struct mv88e6xxx_devlink_atu_entry);
                        break;
                case MV88E6XXX_REGION_VTU:
-                       size = mv88e6xxx_max_vid(chip) *
+                       size = (mv88e6xxx_max_vid(chip) + 1) *
                                sizeof(struct mv88e6xxx_devlink_vtu_entry);
                        break;
                }