Skip to content

Commit f27b405

Browse files
LorenzoBianconidavem330
authored andcommitted
net: ethernet: mtk_eth_soc: check max allowed hash in mtk_ppe_check_skb
Even if max hash configured in hw in mtk_ppe_hash_entry is MTK_PPE_ENTRIES - 1, check theoretical OOB accesses in mtk_ppe_check_skb routine Fixes: c4f033d ("net: ethernet: mtk_eth_soc: rework hardware flow table management") Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9cb252c commit f27b405

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/ethernet/mediatek/mtk_ppe.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
293293
if (!ppe)
294294
return;
295295

296+
if (hash > MTK_PPE_HASH_MASK)
297+
return;
298+
296299
now = (u16)jiffies;
297300
diff = now - ppe->foe_check_time[hash];
298301
if (diff < HZ / 10)

0 commit comments

Comments
 (0)