Skip to content

Commit 5e13f2c

Browse files
author
Florian Westphal
committed
netfilter: nft_set_bitmap: fix lockdep splat due to missing annotation
Running new 'set_flush_add_atomic_bitmap' test case for nftables.git with CONFIG_PROVE_RCU_LIST=y yields: net/netfilter/nft_set_bitmap.c:231 RCU-list traversed in non-reader section!! rcu_scheduler_active = 2, debug_locks = 1 1 lock held by nft/4008: #0: ffff888147f79cd8 (&nft_net->commit_mutex){+.+.}-{4:4}, at: nf_tables_valid_genid+0x2f/0xd0 lockdep_rcu_suspicious+0x116/0x160 nft_bitmap_walk+0x22d/0x240 nf_tables_delsetelem+0x1010/0x1a00 .. This is a false positive, the list cannot be altered while the transaction mutex is held, so pass the relevant argument to the iterator. Fixes tag intentionally wrong; no point in picking this up if earlier false-positive-fixups were not applied. Fixes: 28b7a6b ("netfilter: nf_tables: avoid false-positive lockdep splats in set walker") Signed-off-by: Florian Westphal <[email protected]>
1 parent 78dd8ad commit 5e13f2c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/netfilter/nft_set_bitmap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ static void nft_bitmap_walk(const struct nft_ctx *ctx,
226226
const struct nft_bitmap *priv = nft_set_priv(set);
227227
struct nft_bitmap_elem *be;
228228

229-
list_for_each_entry_rcu(be, &priv->list, head) {
229+
list_for_each_entry_rcu(be, &priv->list, head,
230+
lockdep_is_held(&nft_pernet(ctx->net)->commit_mutex)) {
230231
if (iter->count < iter->skip)
231232
goto cont;
232233

0 commit comments

Comments
 (0)