Re: [syzbot] [netfilter?] KASAN: slab-use-after-free Read in nf_tables_trans_destroy_work
From: Edward Adam Davis
Date: Tue Jul 02 2024 - 09:21:12 EST
Unbalanced increase and decrease of use in the table
#syz test: net-next 1c5fc27bc48a
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 70d0bad029fd..b77b764955a0 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1498,6 +1498,7 @@ static int nf_tables_newtable(struct sk_buff *skb, const struct nfnl_info *info,
if (err < 0)
goto err_trans;
+ nft_use_inc_restore(&table->use);
list_add_tail_rcu(&table->list, &nft_net->tables);
return 0;
err_trans: