Skip to content

Commit 8e4052c

Browse files
Dan Carpenterkuba-moo
authored andcommitted
net: dsa: b53: fix an off by one in checking "vlan->vid"
The > comparison should be >= to prevent accessing one element beyond the end of the dev->vlans[] array in the caller function, b53_vlan_add(). The "dev->vlans" array is allocated in the b53_switch_init() function and it has "dev->num_vlans" elements. Fixes: a2482d2 ("net: dsa: b53: Plug in VLAN support") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/YAbxI97Dl/pmBy5V@mwanda Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b160c28 commit 8e4052c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ int b53_vlan_prepare(struct dsa_switch *ds, int port,
14041404
!(vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED))
14051405
return -EINVAL;
14061406

1407-
if (vlan->vid_end > dev->num_vlans)
1407+
if (vlan->vid_end >= dev->num_vlans)
14081408
return -ERANGE;
14091409

14101410
b53_enable_vlan(dev, true, ds->vlan_filtering);

0 commit comments

Comments
 (0)