From: Dan Carpenter <hidden> Date: 2021-01-19 18:27:18
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: a2482d2ce349 ("net: dsa: b53: Plug in VLAN support")
Signed-off-by: Dan Carpenter <redacted>
---
drivers/net/dsa/b53/b53_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -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);
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: a2482d2ce349 ("net: dsa: b53: Plug in VLAN support")
Signed-off-by: Dan Carpenter <redacted>
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-01-20 03:38:02
On Tue, 19 Jan 2021 09:14:03 -0800 Florian Fainelli wrote:
On 1/19/2021 6:48 AM, Dan Carpenter wrote:
quoted
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: a2482d2ce349 ("net: dsa: b53: Plug in VLAN support")
Signed-off-by: Dan Carpenter <redacted>