netfilter: nf_tables: use rcu chain hook list iterator from netlink dump path
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 1/1 netfilter: nf_tables: use rcu chain hook list iterator from netlink dump path
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 <[email protected]>
---
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(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -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;
Signature · 1 line
2.30.2
Florian Westphal
maintainerQuoted 3 lines · Pablo Neira Ayuso
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.
Thanks for following up, this indeed needs _rcu variant.