mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 22:37:45 -04:00
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: a2482d2ce3 ("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]>
This commit is contained in:
1 parent
b160c28548
commit
8e4052c32d
1 file changed
+1
-1
@@ -1404,7 +1404,7 @@ int b53_vlan_prepare(struct dsa_switch *ds, int port,
|
||||
!(vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED))
|
||||
return -EINVAL;
|
||||
|
||||
if (vlan->vid_end > dev->num_vlans)
|
||||
if (vlan->vid_end >= dev->num_vlans)
|
||||
return -ERANGE;
|
||||
|
||||
b53_enable_vlan(dev, true, ds->vlan_filtering);
|
||||
|
||||
Reference in new issue
Block a user