ath25: switch default kernel to 5.15
[openwrt/staging/ldir.git] / target / linux / generic / pending-5.10 / 700-net-ethernet-mtk_eth_soc-avoid-creating-duplicate-of.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 8 Jul 2021 07:08:29 +0200
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: avoid creating duplicate offload
4 entries
5
6 Sometimes multiple CLS_REPLACE calls are issued for the same connection.
7 rhashtable_insert_fast does not check for these duplicates, so multiple
8 hardware flow entries can be created.
9 Fix this by checking for an existing entry early
10
11 Fixes: 502e84e2382d ("net: ethernet: mtk_eth_soc: add flow offloading support")
12 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 ---
14
15 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
16 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
17 @@ -187,6 +187,9 @@ mtk_flow_offload_replace(struct mtk_eth
18 int hash;
19 int i;
20
21 + if (rhashtable_lookup(&eth->flow_table, &f->cookie, mtk_flow_ht_params))
22 + return -EEXIST;
23 +
24 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META)) {
25 struct flow_match_meta match;
26