Article View: linux.kernel.netdev
Article #24810[PATCH net 10/10] netfilter: nf_tables: only disable tables on a dormant transition
From: Pablo Neira Ayuso
Date: Mon, 30 Nov 2026 21:51
Date: Mon, 30 Nov 2026 21:51
44 lines
9932 bytes
9932 bytes
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 <luoxuanqiang@kylinos.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
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
Technical Details
Message-ID:
<20261130215141.1009148-11-pablo@netfilter.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374486-linux-kernel-netdev=dewy.ruReferences:
<20261130215141.1009148-1-pablo@netfilter.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374486-linux-kernel-netdev=dewy.ru From: pablo@netfilter.org (Pablo Neira Ayuso) Newsgroups: linux.kernel.netdev Subject: [PATCH net 10/10] netfilter: nf_tables: only disable tables on a dormant transition Date: Mon, 30 Nov 2026 22:51:41 +0100 Organization: Usenet Network Message-ID: <20261130215141.1009148-11-pablo@netfilter.org> References: <20261130215141.1009148-1-pablo@netfilter.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1547852"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:vVLR/tAW8Z4Me3Nr9CEFt1Y05aY= sha256:xNIPpeUW4ncl7Y/pC1fTSunPokGguOMCjLHZD75Evek= sha1:xZbQhpG20EEas5bFWu/gqOX70sw= sha256:V18FSuCSr2mC2IPnrRs6dgi2C7sjM+nU1X7rLDpJoUk= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A5248126007; Tue, 1 Dec 2026 00:52:42 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=netfilter.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mx5bqZVGzy53; Tue, 1 Dec 2026 00:52:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374486-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=netfilter.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 6C3C812600B; Tue, 1 Dec 2026 00:52:31 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id E9DAC28B5D; Mon, 30 Nov 2026 21:52:12 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796075524; b=Sl+154YR4+BLJahEPDO71ixepZSQ/CpkIhwWVFvVwZDyQMcRAeF8B/TyUqQBEjO+ndcg 1HTgtzYcvj5Do3tTUYUtest+B7kp/Eh1HjBM7xffK2yuvzxlMAikRLPX+SU6hdBY1UHaN qfs6dMrGThypjLM4xekQVYFmTVajdDkCzYe5oKZwkcyW8vBTL7ochLnAeePXZ1q8ew8du 53pYOGRThjZ+nRy5qV3LfDbBp3Ccf6iliQu3eZg6IEfyrpS5Om5Pf16RF8VS/oWIFgHGe NQeVfxTvCD7ajWImEY5uU6I4iGWjwURBfggy+B63vNB49DSqOlOZCIbDM4KPfy76rhA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796075524; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=AYL28BNW7iH9hny4NymuR97cTHok0NqqM5Z8O5cSQbo=; b=mmbLgbVk7lHnfxi0YpcDqOGGGrn+aFKT4BxxON3uGhclwv5aGZiF0UASGHdB1DcO310j l1CVMmNxnXyhaqKHOUlOGbaCxoFlAu6Kt2tgNp0LCN5DB5fJ5c79e1o1AyNbnAvadY+Ht JhzoJa1xljnmaDktgpNAfQ7ghit8IqYxcDFmxUwXKQ4BaC4Ws8Bpp7FCFaZPbnyaPIh/1 MP6Z8prphE3yUHtgglIoT6vigOIkV2tiWmAwg1NXc8ZEJkjchyagO4qPw9iNuZ5jmYzqR eVzrHYkbBg+y85PCv80S+g5of80L6iVpT+H0l73gMt3D22BVpUJW4qGhjX3x/ZEIjsg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=DDjc3rwb; dmarc=none header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; arc=fail smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DDCD8606A68A; Mon, 30 Nov 2026 21:52:03 +0000 (UTC) X-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 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.70.190.124 X-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== X-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== X-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 X-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) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 99623606A6AB X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netfilter.org X-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== X-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) X-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 X-Mailer: git-send-email 2.47.3 X-In-Reply-To: <20261130215141.1009148-1-pablo@netfilter.org> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list