]> www.infradead.org Git - users/jedix/linux-maple.git/commit
netfilter: nf_tables: avoid false-positive lockdep splat on rule deletion
authorFlorian Westphal <fw@strlen.de>
Mon, 4 Nov 2024 09:41:13 +0000 (10:41 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 5 Nov 2024 21:06:10 +0000 (22:06 +0100)
commit9adbb4198bf6cf3634032871118a7052aeaa573f
tree17eddadb262d009c3ab7490815289678321c3190
parent08e52cccae11a4148a5810f0bd5614796994d221
netfilter: nf_tables: avoid false-positive lockdep splat on rule deletion

On rule delete we get:
 WARNING: suspicious RCU usage
 net/netfilter/nf_tables_api.c:3420 RCU-list traversed in non-reader section!!
 1 lock held by iptables/134:
   #0: ffff888008c4fcc8 (&nft_net->commit_mutex){+.+.}-{3:3}, at: nf_tables_valid_genid (include/linux/jiffies.h:101) nf_tables

Code is fine, no other CPU can change the list because we're holding
transaction mutex.

Pass the needed lockdep annotation to the iterator and fix
two comments for functions that are no longer restricted to rcu-only
context.

This is enough to resolve rule delete, but there are several other
missing annotations, added in followup-patches.

Fixes: 28875945ba98 ("rcu: Add support for consolidated-RCU reader checking")
Reported-by: Matthieu Baerts <matttbe@kernel.org>
Tested-by: Matthieu Baerts <matttbe@kernel.org>
Closes: https://lore.kernel.org/netfilter-devel/da27f17f-3145-47af-ad0f-7fd2a823623e@kernel.org/
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c