From: Ma Xinmeng <1564938642@qq.com> nf_tables_commit() calls nf_tables_table_disable() for every NEWTABLE transaction that has NFT_TABLE_F_DORMANT set and __NFT_TABLE_F_UPDATE. Since table adoption introduced __NFT_TABLE_F_WAS_ORPHAN, UPDATE no longer implies a dormant state change: re-owning an already dormant PERSIST orphan sets UPDATE because of the adoption, even though the table never left the dormant state. The commit then clears DORMANT, walks the basechains, and unregisters a hook that was never registered, which triggers WARN_ONCE("hook not found") in __nf_unregister_net_hook(). Use __NFT_TABLE_F_WAS_AWAKEN, which records an awake-to-dormant transition, instead of the current DORMANT flag. This skips the disable for an already dormant adopted table while preserving the genuine awake-to-dormant path. Fixes: 31bf508be656 ("netfilter: nf_tables: Implement table adoption support") Signed-off-by: Ma Xinmeng <1564938642@qq.com> Reviewed-by: Xuanqiang Luo Signed-off-by: Pablo Neira Ayuso --- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 8b94b5e7dbdb..b184c739cb67 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -11078,7 +11078,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) nft_trans_destroy(trans); break; } - if (table->flags & NFT_TABLE_F_DORMANT) + if (table->flags & __NFT_TABLE_F_WAS_AWAKEN) nf_tables_table_disable(net, table); table->flags &= ~__NFT_TABLE_F_UPDATE; -- 2.47.3