Skip to content

Commit

Permalink
net: ethernet: mtk_eth_soc: check max allowed hash in mtk_ppe_check_skb
Browse files Browse the repository at this point in the history
[ Upstream commit f27b405 ]

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]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
LorenzoBianconi authored and gregkh committed Sep 15, 2022
1 parent 0378b06 commit e484616
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/mediatek/mtk_ppe.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
if (!ppe)
return;

if (hash > MTK_PPE_HASH_MASK)
return;

now = (u16)jiffies;
diff = now - ppe->foe_check_time[hash];
if (diff < HZ / 10)
Expand Down

0 comments on commit e484616

Please sign in to comment.