Commit a5b8c960 authored by Joseph Huang's avatar Joseph Huang Committed by Zhang Changzhong
Browse files

net: dsa: mv88e6xxx: Fix out-of-bound access

stable inclusion
from stable-v5.10.225
commit 050e7274ab2150cd212b2372595720e7b83a15bd
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAOXZQ
CVE: CVE-2024-44988

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=050e7274ab2150cd212b2372595720e7b83a15bd



---------------------------

[ Upstream commit 528876d867a23b5198022baf2e388052ca67c952 ]

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: 75c05a74 ("net: dsa: mv88e6xxx: Fix counting of ATU violations")
Signed-off-by: default avatarJoseph Huang <Joseph.Huang@garmin.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20240819235251.1331763-1-Joseph.Huang@garmin.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parent a9d58bf5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -453,6 +453,7 @@ 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);
		if (spid < ARRAY_SIZE(chip->ports))
			chip->ports[spid].atu_full_violation++;
	}
	mv88e6xxx_reg_unlock(chip);