From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.70.190.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796075523; b=t68kjUDT1PKPp68874cZVwA/qwY5hzLFm/O1ntZ81YCTsDEKv9zSVVN7OA+SkrVWF6uT hTJHAC7Xj19QykZ55ltloMhjt1Ag4sL5cgvV4eFu/JRfiYdDhqSnoqe0Wig2WLJilpikU dY0vkW79dCOk28+AB1PjsC4b/NtJRKnn+onK0CWv+J8X573AZbPdoFvBubYPt7sWrn6jb 3Rvb97u/V55LpKKO1fcMAD+zTL91JQ3S/rAzv0m6RQjFuTJXnK9HXje5NZxBuT1RDVGS5 x9EQoltuPnaz/R/lMEca+iGDa6AMClL7jUw1afixc/sfRFlXLpOAQX5307hEnmZ2U/w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796075523; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version; bh=AYL28BNW7iH9hny4NymuR97cTHok0NqqM5Z8O5cSQbo=; b=HmVqqlCt1pBZseyWBJyqgE0bIY0voj5GM7Xqav9tk4djMUf5CGjcQ9du40kXH8XbJxZI 56R48/akCIruKV7dYbyAP9scfJ50s26y1qIr1XfT2GbSD7FpPRNjYddJbMEOpNarSK3CN n1iMmOAl+FVgmd4bijZ5pTcBhORIx5VGRGtEyQIRmhRVwHNuAGm6h4YrXI3ZK8UXIQ3pi hwrim2aNvIcbWcv0X+9o5xXqHZ3gZZIeRL/hSNNpc2seTx4nCpp4s+EthSCBeWHYtR9OL pb6iT7rkFCpMm+T0kLB/MHfCADhLjIOZqDBixFhHGWBobCVa3ZKQlpGsog3GYYxTO8g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=DDjc3rwb; arc=none smtp.remote-ip=217.70.190.124 Received: from mail.netfilter.org (mail.netfilter.org [217.70.190.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99623606A6AB; Mon, 30 Nov 2026 21:52:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 99623606A6AB Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netfilter.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=DDjc3rwb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netfilter.org; s=2025; t=1796075520; bh=AYL28BNW7iH9hny4NymuR97cTHok0NqqM5Z8O5cSQbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DDjc3rwbb8VU8INwiyDadBSqmowGYJF/ofPlAEIEg4Jl3XecKZa8pB2Cs+98aGh4v Q/K5lUNdTArNyF1ptL6kVWosHaoQqMiYMA5dTk5ai6XZeUjUEtugWt8XJ7hGdEkMRP a4P+UU+UJ2zmy+dQw4Vw1KGlhfCV4Ph9/gBALpV4QvCzL5ZLpizfIHHj676dvJJdMB XZmjJKudkpHBiRqYC9Osd/DzIx3aBG3JGN0EtvWiToUctlFsZXmEa8qE13sfzKofyX vyQm5SseG5ngeqjqfZi50yXY2KceGxUFXv/F8UIXZnC4OWJ7NHWL8keJmboeMajiAA ycoaO+O8tMs4Q== Received: from localhost.localdomain (mail-agni [217.70.190.124]) by mail.netfilter.org (Postfix) with ESMTPSA id 598F660085; Mon, 30 Nov 2026 22:52:00 +0100 (CET) From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg Subject: [PATCH net 10/10] netfilter: nf_tables: only disable tables on a dormant transition Date: Mon, 30 Nov 2026 22:51:41 +0100 Message-ID: <20261130215141.1009148-11-pablo@netfilter.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261130215141.1009148-1-pablo@netfilter.org> References: <20261130215141.1009148-1-pablo@netfilter.org> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(). Note that NAT hook refcount corruption is also possible along with WARN_ON(users == 0) since NAT hook unregistration follows a different path. 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