Skip to content

Commit 528876d

Browse files
Joseph Huangkuba-moo
authored andcommitted
net: dsa: mv88e6xxx: Fix out-of-bound access
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: 75c05a7 ("net: dsa: mv88e6xxx: Fix counting of ATU violations") Signed-off-by: Joseph Huang <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6efea51 commit 528876d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/dsa/mv88e6xxx/global1_atu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id)
457457
trace_mv88e6xxx_atu_full_violation(chip->dev, spid,
458458
entry.portvec, entry.mac,
459459
fid);
460-
chip->ports[spid].atu_full_violation++;
460+
if (spid < ARRAY_SIZE(chip->ports))
461+
chip->ports[spid].atu_full_violation++;
461462
}
462463

463464
return IRQ_HANDLED;

0 commit comments

Comments
 (0)