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
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 <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
LorenzoBianconi authored and davem330 committed Sep 7, 2022
1 parent 9cb252c commit f27b405
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 f27b405

Please sign in to comment.