netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net 1/1] net: dsa: mv88e6xxx: Fix out-of-bound access
@ 2024-08-19 23:52 Joseph Huang
  2024-08-20 13:46 ` Andrew Lunn
  2024-08-21  0:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Joseph Huang @ 2024-08-19 23:52 UTC (permalink / raw)
  To: netdev
  Cc: Joseph Huang, Andrew Lunn, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	linux-kernel

If an ATU violation was caused by a CPU Load operation, the SPID could
be larger than DSA_MAX_PORTS (the size of mv88e6xxx_chip.ports[] array).

Fixes: 75c05a74e745 ("net: dsa: mv88e6xxx: Fix counting of ATU violations")
Signed-off-by: Joseph Huang <Joseph.Huang@garmin.com>
---
v1: https://lore.kernel.org/lkml/20240819222641.1292308-1-Joseph.Huang@garmin.com/
v2: Use ARRAY_SIZE instead of hard-coded SPID value.
---
 drivers/net/dsa/mv88e6xxx/global1_atu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c
index ce3b3690c3c0..c47f068f56b3 100644
--- a/drivers/net/dsa/mv88e6xxx/global1_atu.c
+++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c
@@ -457,7 +457,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id)
 		trace_mv88e6xxx_atu_full_violation(chip->dev, spid,
 						   entry.portvec, entry.mac,
 						   fid);
-		chip->ports[spid].atu_full_violation++;
+		if (spid < ARRAY_SIZE(chip->ports))
+			chip->ports[spid].atu_full_violation++;
 	}
 
 	return IRQ_HANDLED;
-- 
2.17.1


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

* Re: [PATCH v2 net 1/1] net: dsa: mv88e6xxx: Fix out-of-bound access
  2024-08-19 23:52 [PATCH v2 net 1/1] net: dsa: mv88e6xxx: Fix out-of-bound access Joseph Huang
@ 2024-08-20 13:46 ` Andrew Lunn
  2024-08-21  0:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2024-08-20 13:46 UTC (permalink / raw)
  To: Joseph Huang
  Cc: netdev, Florian Fainelli, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-kernel

On Mon, Aug 19, 2024 at 07:52:50PM -0400, Joseph Huang wrote:
> If an ATU violation was caused by a CPU Load operation, the SPID could
> be larger than DSA_MAX_PORTS (the size of mv88e6xxx_chip.ports[] array).
> 
> Fixes: 75c05a74e745 ("net: dsa: mv88e6xxx: Fix counting of ATU violations")
> Signed-off-by: Joseph Huang <Joseph.Huang@garmin.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH v2 net 1/1] net: dsa: mv88e6xxx: Fix out-of-bound access
  2024-08-19 23:52 [PATCH v2 net 1/1] net: dsa: mv88e6xxx: Fix out-of-bound access Joseph Huang
  2024-08-20 13:46 ` Andrew Lunn
@ 2024-08-21  0:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-21  0:00 UTC (permalink / raw)
  To: Joseph Huang
  Cc: netdev, andrew, f.fainelli, olteanv, davem, edumazet, kuba,
	pabeni, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 19 Aug 2024 19:52:50 -0400 you wrote:
> If an ATU violation was caused by a CPU Load operation, the SPID could
> be larger than DSA_MAX_PORTS (the size of mv88e6xxx_chip.ports[] array).
> 
> Fixes: 75c05a74e745 ("net: dsa: mv88e6xxx: Fix counting of ATU violations")
> Signed-off-by: Joseph Huang <Joseph.Huang@garmin.com>
> ---
> v1: https://lore.kernel.org/lkml/20240819222641.1292308-1-Joseph.Huang@garmin.com/
> v2: Use ARRAY_SIZE instead of hard-coded SPID value.
> 
> [...]

Here is the summary with links:
  - [v2,net,1/1] net: dsa: mv88e6xxx: Fix out-of-bound access
    https://git.kernel.org/netdev/net/c/528876d867a2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-08-21  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19 23:52 [PATCH v2 net 1/1] net: dsa: mv88e6xxx: Fix out-of-bound access Joseph Huang
2024-08-20 13:46 ` Andrew Lunn
2024-08-21  0:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).