Commit 014d0298 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by David S. Miller

net: ethernet: mtk_eth_soc: missing mutex

Patch 2ed37183 ("netfilter: flowtable: separate replace, destroy and
stats to different workqueues") splits the workqueue per event type. Add
a mutex to serialize updates.

Fixes: 502e84e2 ("net: ethernet: mtk_eth_soc: add flow offloading support")
Reported-by: default avatarFrank Wunderlich <frank-w@public-files.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0e389028
...@@ -391,6 +391,8 @@ mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f) ...@@ -391,6 +391,8 @@ mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)
return 0; return 0;
} }
static DEFINE_MUTEX(mtk_flow_offload_mutex);
static int static int
mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv) mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv)
{ {
...@@ -398,6 +400,7 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pri ...@@ -398,6 +400,7 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pri
struct net_device *dev = cb_priv; struct net_device *dev = cb_priv;
struct mtk_mac *mac = netdev_priv(dev); struct mtk_mac *mac = netdev_priv(dev);
struct mtk_eth *eth = mac->hw; struct mtk_eth *eth = mac->hw;
int err;
if (!tc_can_offload(dev)) if (!tc_can_offload(dev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -405,18 +408,24 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pri ...@@ -405,18 +408,24 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pri
if (type != TC_SETUP_CLSFLOWER) if (type != TC_SETUP_CLSFLOWER)
return -EOPNOTSUPP; return -EOPNOTSUPP;
mutex_lock(&mtk_flow_offload_mutex);
switch (cls->command) { switch (cls->command) {
case FLOW_CLS_REPLACE: case FLOW_CLS_REPLACE:
return mtk_flow_offload_replace(eth, cls); err = mtk_flow_offload_replace(eth, cls);
break;
case FLOW_CLS_DESTROY: case FLOW_CLS_DESTROY:
return mtk_flow_offload_destroy(eth, cls); err = mtk_flow_offload_destroy(eth, cls);
break;
case FLOW_CLS_STATS: case FLOW_CLS_STATS:
return mtk_flow_offload_stats(eth, cls); err = mtk_flow_offload_stats(eth, cls);
break;
default: default:
return -EOPNOTSUPP; err = -EOPNOTSUPP;
break;
} }
mutex_unlock(&mtk_flow_offload_mutex);
return 0; return err;
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment