All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: b53: fix an off by one in checking "vlan->vid"
@ 2021-01-19 14:48 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-01-19 14:48 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Andrew Lunn, Vivien Didelot, Vladimir Oltean, David S. Miller,
	Jakub Kicinski, netdev, kernel-janitors

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 <dan.carpenter@oracle.com>
---
 drivers/net/dsa/b53/b53_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 288b5a5c3e0d..95c7fa171e35 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -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);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net] net: dsa: b53: fix an off by one in checking "vlan->vid"
@ 2021-01-19 14:48 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-01-19 14:48 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Andrew Lunn, Vivien Didelot, Vladimir Oltean, David S. Miller,
	Jakub Kicinski, netdev, kernel-janitors

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 <dan.carpenter@oracle.com>
---
 drivers/net/dsa/b53/b53_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 288b5a5c3e0d..95c7fa171e35 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -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);
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net] net: dsa: b53: fix an off by one in checking "vlan->vid"
  2021-01-19 14:48 ` Dan Carpenter
@ 2021-01-19 17:14   ` Florian Fainelli
  -1 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2021-01-19 17:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Lunn, Vivien Didelot, Vladimir Oltean, David S. Miller,
	Jakub Kicinski, netdev, kernel-janitors



On 1/19/2021 6:48 AM, Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] net: dsa: b53: fix an off by one in checking "vlan->vid"
@ 2021-01-19 17:14   ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2021-01-19 17:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Lunn, Vivien Didelot, Vladimir Oltean, David S. Miller,
	Jakub Kicinski, netdev, kernel-janitors



On 1/19/2021 6:48 AM, Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] net: dsa: b53: fix an off by one in checking "vlan->vid"
  2021-01-19 17:14   ` Florian Fainelli
@ 2021-01-20  3:35     ` Jakub Kicinski
  -1 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2021-01-20  3:35 UTC (permalink / raw)
  To: Florian Fainelli, Dan Carpenter
  Cc: Andrew Lunn, Vivien Didelot, Vladimir Oltean, David S. Miller,
	netdev, kernel-janitors

On Tue, 19 Jan 2021 09:14:03 -0800 Florian Fainelli wrote:
> On 1/19/2021 6:48 AM, Dan Carpenter wrote:
> > 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 <dan.carpenter@oracle.com>  
> 
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] net: dsa: b53: fix an off by one in checking "vlan->vid"
@ 2021-01-20  3:35     ` Jakub Kicinski
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2021-01-20  3:35 UTC (permalink / raw)
  To: Florian Fainelli, Dan Carpenter
  Cc: Andrew Lunn, Vivien Didelot, Vladimir Oltean, David S. Miller,
	netdev, kernel-janitors

On Tue, 19 Jan 2021 09:14:03 -0800 Florian Fainelli wrote:
> On 1/19/2021 6:48 AM, Dan Carpenter wrote:
> > 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 <dan.carpenter@oracle.com>  
> 
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-20  3:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 14:48 [PATCH net] net: dsa: b53: fix an off by one in checking "vlan->vid" Dan Carpenter
2021-01-19 14:48 ` Dan Carpenter
2021-01-19 17:14 ` Florian Fainelli
2021-01-19 17:14   ` Florian Fainelli
2021-01-20  3:35   ` Jakub Kicinski
2021-01-20  3:35     ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.