diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2022-09-05 15:41:28 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-09-07 17:29:40 +0300 |
commit | f27b405ef43319a3ceefc2123245201a63ed4e00 (patch) | |
tree | 557502d19c546f2bdf52775208b5d271a9a3b9df /drivers/net/ethernet/mediatek | |
parent | 9cb252c4c1c53ae58bc565bab76e98133288f23a (diff) | |
download | linux-f27b405ef43319a3ceefc2123245201a63ed4e00.tar.xz |
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: c4f033d9e03e9 ("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>
Diffstat (limited to 'drivers/net/ethernet/mediatek')
-rw-r--r-- | drivers/net/ethernet/mediatek/mtk_ppe.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.h b/drivers/net/ethernet/mediatek/mtk_ppe.h index 1f5cf1c9a947..69ffce04d630 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h @@ -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) |