]> www.infradead.org Git - users/jedix/linux-maple.git/commit
netfilter: nf_tables: must hold rcu read lock while iterating object type list
authorFlorian Westphal <fw@strlen.de>
Mon, 4 Nov 2024 09:41:19 +0000 (10:41 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 5 Nov 2024 21:07:12 +0000 (22:07 +0100)
commitcddc04275f95ca3b18da5c0fb111705ac173af89
tree327062f50e9ff4416b016b4b40e6610178cec9ad
parentee666a541ed957937454d50afa4757924508cd74
netfilter: nf_tables: must hold rcu read lock while iterating object type list

Update of stateful object triggers:
WARNING: suspicious RCU usage
net/netfilter/nf_tables_api.c:7759 RCU-list traversed in non-reader section!!

other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
1 lock held by nft/3060:
 #0: ffff88810f0578c8 (&nft_net->commit_mutex){+.+.}-{4:4}, [..]

... but this list is not protected by the transaction mutex but the
nfnl nftables subsystem mutex.

Switch to nft_obj_type_get which will acquire rcu read lock,
bump refcount, and returns the result.

v3: Dan Carpenter points out nft_obj_type_get returns error pointer, not
NULL, on error.

Fixes: dad3bdeef45f ("netfilter: nf_tables: fix memory leak during stateful obj update").
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c