Skip to content

Commit 9f6b606

Browse files
LorenzoBianconiPaolo Abeni
authored andcommitted
net: airoha: ppe: Do not invalid PPE entries in case of SW hash collision
SW hash computed by airoha_ppe_foe_get_entry_hash routine (used for foe_flow hlist) can theoretically produce collisions between two different HW PPE entries. In airoha_ppe_foe_insert_entry() if the collision occurs we will mark the second PPE entry in the list as stale (setting the hw hash to 0xffff). Stale entries are no more updated in airoha_ppe_foe_flow_entry_update routine and so they are removed by Netfilter. Fix the problem not marking the second entry as stale in airoha_ppe_foe_insert_entry routine if we have already inserted the brand new entry in the PPE table and let Netfilter remove real stale entries according to their timestamp. Please note this is just a theoretical issue spotted reviewing the code and not faced running the system. Fixes: cd53f62 ("net: airoha: Add L2 hw acceleration support") Signed-off-by: Lorenzo Bianconi <[email protected]> Link: https://patch.msgid.link/20250818-airoha-en7581-hash-collision-fix-v1-1-d190c4b53d1c@kernel.org Signed-off-by: Paolo Abeni <[email protected]>
1 parent 184fa9d commit 9f6b606

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/net/ethernet/airoha/airoha_ppe.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,10 +736,8 @@ static void airoha_ppe_foe_insert_entry(struct airoha_ppe *ppe,
736736
continue;
737737
}
738738

739-
if (commit_done || !airoha_ppe_foe_compare_entry(e, hwe)) {
740-
e->hash = 0xffff;
739+
if (!airoha_ppe_foe_compare_entry(e, hwe))
741740
continue;
742-
}
743741

744742
airoha_ppe_foe_commit_entry(ppe, &e->data, hash);
745743
commit_done = true;

0 commit comments

Comments
 (0)