7ab6d486b2256e6900691fac8a53a3a3d0638659
[openwrt/staging/blogic.git] /
1 From 4253e6e2b795a18ab534adcd5c313d3fc4150975 Mon Sep 17 00:00:00 2001
2 Message-Id: <4253e6e2b795a18ab534adcd5c313d3fc4150975.1662332102.git.lorenzo@kernel.org>
3 In-Reply-To: <2a60545635c2705312299384f4e9fec2f2a3acd6.1662332102.git.lorenzo@kernel.org>
4 References: <2a60545635c2705312299384f4e9fec2f2a3acd6.1662332102.git.lorenzo@kernel.org>
5 From: Lorenzo Bianconi <lorenzo@kernel.org>
6 Date: Mon, 5 Sep 2022 00:48:52 +0200
7 Subject: [PATCH net-next 3/6] net: ethernet: mtk_eth_soc: check max allowed
8 value in mtk_ppe_check_skb
9
10 Check theoretical OOB accesses in mtk_ppe_check_skb routine
11
12 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
13 ---
14 drivers/net/ethernet/mediatek/mtk_ppe.h | 3 +++
15 1 file changed, 3 insertions(+)
16
17 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h
18 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
19 @@ -294,6 +294,9 @@ mtk_ppe_check_skb(struct mtk_ppe *ppe, s
20 if (!ppe)
21 return;
22
23 + if (hash > MTK_PPE_HASH_MASK)
24 + return;
25 +
26 now = (u16)jiffies;
27 diff = now - ppe->foe_check_time[hash];
28 if (diff < HZ / 10)