Commit a6134e62 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso
Browse files

netfilter: nf_tables: join hook list via splice_list_rcu() in commit phase



Publish new hooks in the list into the basechain/flowtable using
splice_list_rcu() to ensure netlink dump list traversal via rcu is safe
while concurrent ruleset update is going on.

Fixes: 78d9f48f ("netfilter: nf_tables: add devices to existing flowtable")
Fixes: b9703ed4 ("netfilter: nf_tables: support for adding new devices to an existing netdev chain")
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent f902877b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -10838,7 +10838,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
				nft_chain_commit_update(nft_trans_container_chain(trans));
				nf_tables_chain_notify(&ctx, NFT_MSG_NEWCHAIN,
						       &nft_trans_chain_hooks(trans));
				list_splice(&nft_trans_chain_hooks(trans),
				list_splice_rcu(&nft_trans_chain_hooks(trans),
						&nft_trans_basechain(trans)->hook_list);
				/* trans destroyed after rcu grace period */
			} else {
@@ -10968,7 +10968,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
							   nft_trans_flowtable(trans),
							   &nft_trans_flowtable_hooks(trans),
							   NFT_MSG_NEWFLOWTABLE);
				list_splice(&nft_trans_flowtable_hooks(trans),
				list_splice_rcu(&nft_trans_flowtable_hooks(trans),
						&nft_trans_flowtable(trans)->hook_list);
			} else {
				nft_clear(net, nft_trans_flowtable(trans));