Skip to content

Commit 8313c48

Browse files
committed
netfilter: nf_tables: netlink notifier might race to release objects
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2134544 Upstream Status: commit d4bc827 commit d4bc827 Author: Pablo Neira Ayuso <pablo@netfilter.org> Date: Wed Oct 26 09:52:36 2022 +0200 netfilter: nf_tables: netlink notifier might race to release objects commit release path is invoked via call_rcu and it runs lockless to release the objects after rcu grace period. The netlink notifier handler might win race to remove objects that the transaction context is still referencing from the commit release path. Call rcu_barrier() to ensure pending rcu callbacks run to completion if the list of transactions to be destroyed is not empty. Fixes: 6001a93 ("netfilter: nftables: introduce table ownership") Reported-by: syzbot+8f747f62763bc6c32916@syzkaller.appspotmail.com Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fwestpha@redhat.com>
1 parent 65fbaf6 commit 8313c48

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9824,6 +9824,8 @@ static int nft_rcv_nl_event(struct notifier_block *this, unsigned long event,
98249824
nft_net = nft_pernet(net);
98259825
deleted = 0;
98269826
mutex_lock(&nft_net->commit_mutex);
9827+
if (!list_empty(&nf_tables_destroy_list))
9828+
rcu_barrier();
98279829
again:
98289830
list_for_each_entry(table, &nft_net->tables, list) {
98299831
if (nft_table_has_owner(table) &&

0 commit comments

Comments
 (0)