From: wenxu <we...@ucloud.cn>

The flow_block_ing_cmd() needs to call blocking functions while iterating
block_ing_cb_list, nft_indr_block_get_and_ing_cmd is in the cb_list,
So it is the incorrect rcu case. To fix it just traverse the list under
the commit mutex.

Fixes: 9a32669fecfb ("netfilter: nf_tables_offload: support indr block call")
Signed-off-by: wenxu <we...@ucloud.cn>
---
 net/netfilter/nf_tables_offload.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_tables_offload.c 
b/net/netfilter/nf_tables_offload.c
index b95e27b..5431741 100644
--- a/net/netfilter/nf_tables_offload.c
+++ b/net/netfilter/nf_tables_offload.c
@@ -363,11 +363,12 @@ void nft_indr_block_get_and_ing_cmd(struct net_device 
*dev,
        const struct nft_table *table;
        const struct nft_chain *chain;
 
-       list_for_each_entry_rcu(table, &net->nft.tables, list) {
+       mutex_lock(&net->nft.commit_mutex);
+       list_for_each_entry(table, &net->nft.tables, list) {
                if (table->family != NFPROTO_NETDEV)
                        continue;
 
-               list_for_each_entry_rcu(chain, &table->chains, list) {
+               list_for_each_entry(chain, &table->chains, list) {
                        if (nft_is_base_chain(chain)) {
                                struct nft_base_chain *basechain;
 
@@ -382,4 +383,5 @@ void nft_indr_block_get_and_ing_cmd(struct net_device *dev,
                        }
                }
        }
+       mutex_unlock(&net->nft.commit_mutex);
 }
-- 
1.8.3.1

Reply via email to