openwrt-mirror/target/linux/generic/pending-6.12/736-05-net-ethernet-mtk_eth_soc-zero-initialize-PPE-flow-ta.patch
Felix Fietkau 36d0690993 kernel: mtk_eth_soc: zero-initialize PPE flow tables
Prevents invalid flow table data from leaking across reboots

Fixes: https://github.com/openwrt/openwrt/issues/19895
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-09-12 14:39:49 +02:00

28 lines
826 B
Diff

From: Felix Fietkau <nbd@nbd.name>
Date: Fri, 12 Sep 2025 14:18:14 +0200
Subject: [PATCH] net: ethernet: mtk_eth_soc: zero initialize PPE flow table
Avoid picking up flows from last boot or other invalid data
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -914,6 +914,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_
if (!foe)
goto err_free_l2_flows;
+ memset(foe, 0, MTK_PPE_ENTRIES * soc->foe_entry_size);
ppe->foe_table = foe;
foe_flow_size = (MTK_PPE_ENTRIES / soc->hash_offset) *
@@ -928,6 +929,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_
if (!mib)
return NULL;
+ memset(mib, 0, MTK_PPE_ENTRIES * sizeof(*mib));
ppe->mib_table = mib;
acct = devm_kzalloc(dev, MTK_PPE_ENTRIES * sizeof(*acct),