[PATCH nf] netfilter: nf_tables: use rcu chain hook list iterator from netlink dump path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lockless iteration over the list of hooks is possible from the netlink
dump path while updates can occur. Use the rcu variant to iterate over
the hook list as is done for flow table hooks.

Fixes: b9703ed44ffb ("netfilter: nf_tables: support for adding new devices to an existing netdev chain")
Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
As a result from discussing recent Phil's patch 1/16 to add dynamic hook
interface binding.

 net/netfilter/nf_tables_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 045ae805adbc..2e1063b58311 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1841,7 +1841,7 @@ static int nft_dump_basechain_hook(struct sk_buff *skb, int family,
 		if (!hook_list)
 			hook_list = &basechain->hook_list;
 
-		list_for_each_entry(hook, hook_list, list) {
+		list_for_each_entry_rcu(hook, hook_list, list) {
 			if (!first)
 				first = hook;
 
-- 
2.30.2





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux