🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15558

[PATCH net-next 13/15] netfilter: flowtable: do not clear the offload bit twice

#15558
From: Pablo Neira Ayuso
Date: Fri, 13 Nov 2026 03:12
49 lines
10241 bytes
From: João Silva <jgc3silva@gmail.com>

An expired hardware flow remains in the flowtable until its asynchronous
hardware deletion completes. Teardown clears IPS_OFFLOAD_BIT, so a packet
can create a replacement flow referencing the same conntrack entry while
the old flow is still waiting for deletion.

The next GC pass calls flow_offload_teardown() on the expired old flow
again, clearing the replacement's offload bit. More packets can then
create additional flows for the same conntrack entry. A pending hardware
work item can also delay deletion and expose the same repeated teardown.

Commit d2d31ea8cd80 ("netfilter: conntrack: fix erronous removal of
offload bit") closed this window for software flows by unlinking them in
the same GC pass and made the conntrack state fixup one-shot, but
hardware flows stay linked until NF_FLOW_HW_DEAD is set.

Make clearing IPS_OFFLOAD_BIT part of the existing one-time teardown
transition, alongside the conntrack state fixup. Subsequent teardown calls
must not alter the offload state now owned by a replacement flow.

Fixes: e5eaac2beb54 ("netfilter: flowtable: fix TCP flow teardown")
Signed-off-by: João Silva <jgc3silva@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_flow_table_core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 733107180d56..d5652e45ee04 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -398,9 +398,11 @@ static void flow_offload_del(struct nf_flowtable *flow_table,
 
 void flow_offload_teardown(struct flow_offload *flow)
 {
+	if (test_and_set_bit(NF_FLOW_TEARDOWN, &flow->flags))
+		return;
+
 	clear_bit(IPS_OFFLOAD_BIT, &flow->ct->status);
-	if (!test_and_set_bit(NF_FLOW_TEARDOWN, &flow->flags))
-		flow_offload_fixup_ct(flow);
+	flow_offload_fixup_ct(flow);
 }
 EXPORT_SYMBOL_GPL(flow_offload_teardown);
 
-- 
2.47.3
Technical Details
Message-ID: <20261113031251.2437074-14-pablo@netfilter.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362397-linux-kernel-netdev=dewy.ru
References: <20261113031251.2437074-1-pablo@netfilter.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362397-linux-kernel-netdev=dewy.ru
From: pablo@netfilter.org (Pablo Neira Ayuso)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 13/15] netfilter: flowtable: do not clear the offload bit twice
Date: Fri, 13 Nov 2026 04:12:49 +0100
Organization: Usenet Network
Message-ID: <20261113031251.2437074-14-pablo@netfilter.org>
References: <20261113031251.2437074-1-pablo@netfilter.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1260654"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:CbvIV2U8SKGMfQdIc/ucIqODhp4= sha256:GReJJ0z9Ky/bEEmR3u5/B6em5q7pGvRQ6NUW0IPKozg=
	sha1:wdwBr8g6Dz+p6x1UdvkLwobSiSw= sha256:rDkCRCh8la+DVO+zpr6hspxqugXSrJiqSrRe2YNFHUU=
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 4340211446F; Fri, 13 Nov 2026 07:29:57 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, URIBL_BLOCKED=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 g7OqodufJ-2E;
	Fri, 13 Nov 2026 07:29:53 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-362397-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 06D7D113674; Fri, 13 Nov 2026 07:29:44 +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 1B32718456A; Fri, 13 Nov 2026 03:14:36 +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=1794539596;
	b=Qh3znBYf2z6KCf2L03vRhWIk5UcKI7CA/0t6q9gN3Z/5LmOeFJ7j/r+zzdD0tA8PQl+L
	 7Y+Vg+xY0gO7wPTMfH+Oc3NlhbR9ZvLDut34Ew/VSPl6HuxuT98cKSR6rNAXp7KV6bzxj
	 T6tvjnKlMiHAEDoQtwNo0ShPTe1HNLD9ivqHvTZoZESX8V0H+Cgq+wpJC3FPkSLqcluwh
	 l8LOykJR6iii1RUGx/TQFKOrHOZYaehK++S12n/QEzNOkf/OMANuhjFZfkPv/ESu2O31s
	 KOHSkYIHlPM43uhUq+mmb6Ogmf9U7WuEJzryjw7fz+yA0oDVyokvq/AoDv/Y5SM7m/g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794539596;
	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-Type:
	 Content-Transfer-Encoding;
	bh=FTn/RvjjO0JCLwm4jGgHFzh7s3V+fumwtuQ0U//+dls=;
	b=AGOyUb1/t2bzH3W+q1mhnTAV//WIThA8u5QbxrOmlFo7N/Yh1KMf/Hxahr0WMFzBOrLq
	 KHGs39QPVppgCyQMiNROTQEUOOIZ/BgTN6kdWofC9b7He6PEnuua+Zrh/tiGcyHaDC6UF
	 +NtH36czJhXAyuMdCoQdoAmaNUOi9zrMR5Gcaa/E+9l6PxjcBcrqmwIsOTntX8OKQTr7E
	 q7awpq+tDOX5+iFF8tqDgYtgeONdpAmhARGXJ9xa+7DcdS4ag/tW956x0b8ac9G1yp9CM
	 0hGS9RDuGFpkF/YqVv+2dy2g7q1R4Nsa5QO7X53itv3/XTaEJVgMOz4EJtolbu83ihg==
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=A9Qyw1ka;
	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 BBF51606A88E;
	Fri, 13 Nov 2026 03:13:16 +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=A9Qyw1ka
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=1794539595;
	b=YscQdpXyLdRvUgy+haFkRx0TcYMh4QoGkgLPjhgx3Ld9Un2tQR8gFjKQeaKtMP9ZAUmx
	 Div5DDf66zHHfT6sx+F2EQTl/p385v1SxkGDTSH7KFoSzErPeseI7OBLSy8v3C5cxIyBf
	 Gqv3bJN1biHDaAxS0o6SSwO7X8awn6VRznsPoeWIjXn2fQXNaPZV2NHssVmesXLwDe8HA
	 9apCouK26WvJTM97QcGwnkTy4gJic/p6mRWMRmEyX7/mgyHTCZe2HPfuoVzerTjqxeDds
	 SP1xUPxOe5DnI+EDW04NOL0ne3cQm12vIzzszPIeclXkUZlDC9ZOVfnwUVIMBTrEdvQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794539595;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version;
	bh=FTn/RvjjO0JCLwm4jGgHFzh7s3V+fumwtuQ0U//+dls=;
	b=GT5MzlMrZLRH7TWkbY0rVZuNJEuwrD4rtSL2dSo20xqHtqo9dBrBfNEvua1n1nJRE/0I
	 TUZMLhqAct4c0iw9bhMvyOYfr2/IbQk7LnHDDRcB1VAra/l0ILJ3QjvRdFzEz6GVmgsKc
	 PzzBlQ29fOF/7u5rU+NS2iQQew41ZQTiFwKS3sXyUiH7M/WhP0OJPJWnVEsu3upj7iZy9
	 mr6bhcorHP2XQNnUr8XQkWiHGExXzZEI2SH5etvM9DBif/IAZm5pOhdx7FViPFiMtJY4y
	 LLoQbSulcpvQHhatuK1WczvnJpgdDEVt40AzQ/+nJF6gnOsxudu8xDe1LGB36WJbOzQ==
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=A9Qyw1ka;
	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 72BC660A3807;
	Fri, 13 Nov 2026 03:13:15 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 72BC660A3807
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=1794539593;
	bh=FTn/RvjjO0JCLwm4jGgHFzh7s3V+fumwtuQ0U//+dls=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
	b=A9Qyw1kalENZCvSscZVsrBiQuh+1VUj9U37bLxs6aElKRM0t4HWEq56eF+shaQCmy
	 emMyYnbcSs+Y/Baz4W3hMwovEd+GdLZjS0Z1rmZ+HnX4sWgNb6VtHhby7deo/ok0bm
	 TTzPAcqDSXAnM/e78Z27CsvWwJBQ6Hw7zNDrqykqF6e+Z6+BGGr9dPdHSLZfKftchR
	 XivKiM10VPSCEAuOOVPE8fr4oPqw6Z9hL9VHZag5QtCsJGnt9RZ8nsb0xHCiWGPA17
	 ybP5FjuQtHOHgYtc9hzarRBXEnYRJIZ9ngdzbgU/Chh+PEmmXqHkK1gWBNdynuXJKO
	 usxke/kiyM+UQ==
X-Received: from localhost.localdomain (mail-agni [217.70.190.124])
	by mail.netfilter.org (Postfix) with ESMTPSA id 3D241602A5;
	Fri, 13 Nov 2026 04:13:13 +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: <20261113031251.2437074-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