Article View: linux.kernel.netdev
Article #17540Re: [PATCH net-next 07/13] netfilter: flowtable: purge entries immediately when destroying the flowtable
From: netdev-bot+sashiko
Date: Tue, 17 Nov 2026 00:22
Date: Tue, 17 Nov 2026 00:22
76 lines
10671 bytes
10671 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message for "netfilter: flowtable: purge entries
immediately when destroying the flowtable" understates the bug itβ¦
--
netfilter: flowtable: purge entries immediately when destroying the flowtable
This commit stops using the hardware offload workqueue to purge the
remaining flow entries when a flowtable is destroyed. nf_flow_table_free()
now calls rhashtable_free_and_destroy() with nf_flow_table_do_purge(),
which tears down each flow, removes it from hardware synchronously and
frees it. NF_FLOW_PENDING marks that the first tuplehash of a flow has
already been visited.
> Work memory
> allocations can fail, leaving us with either waiting indefinitely until
> work can be allocated or leaving entries in the hardware.
[Severity: Low]
Does this fully describe what could happen in the old destroy path?
In the old nf_flow_table_free(), a torn-down flow with NF_FLOW_HW set and
NF_FLOW_HW_DYING clear goes through:
nf_flow_table_gc_run()
nf_flow_offload_gc_step()
nf_flow_offload_del()
nf_flow_offload_work_alloc() /* GFP_ATOMIC */
If that allocation fails, nf_flow_offload_del() returns before it sets
NF_FLOW_HW_DYING:
offload = nf_flow_offload_work_alloc(flowtable, flow, FLOW_CLS_DESTROY);
if (!offload)
return;
set_bit(NF_FLOW_HW_DYING, &flow->flags);
flow_offload_queue_work(offload);
The flow therefore stays in the table for the second pass in
nf_flow_table_offload_flush_cleanup():
flush_workqueue(nf_flow_offload_del_wq);
nf_flow_table_gc_run(flowtable);
If the allocation fails again, rhashtable_destroy() frees only the bucket
tables. Wouldn't the flow_offload leak, along with its nf_conn reference
(nf_ct_put() in flow_offload_free_rcu() never runs) and its route dst
references?
If the allocation succeeds in the second pass, the FLOW_CLS_DESTROY work
is queued after the last flush_workqueue(). Nothing flushes it before
nf_flow_table_free() returns. The flow still leaks, because
flow_offload_del() is never reached for it.
The caller then frees the flowtable. act_ct frees ct_ft after
tcf_ct_flow_table_cleanup_work(), and nf_tables kfree()s the
nft_flowtable that embeds it.
Can flow_offload_work_handler() and flow_offload_work_del() then read
offload->flowtable->net, ->priority and ->flow_block.cb_list from freed
memory?
The code change looks correct and fixes both cases. Could the changelog
also mention the flow, nf_conn and dst leak, and the possible
use-after-free of the flowtable?
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116001612.2806263-2-pablo%40netfilter.org
Technical Details
Message-ID:
<179487497106.3136.16489968297961134711@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364854-linux-kernel-netdev=dewy.ruReferences:
<20261116001612.2806263-8-pablo@netfilter.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364854-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 07/13] netfilter: flowtable: purge entries immediately when destroying the flowtable Date: Tue, 17 Nov 2026 00:22:51 +0000 Organization: Usenet Network Message-ID: <179487497106.3136.16489968297961134711@kernel.org> References: <20261116001612.2806263-8-pablo@netfilter.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2202832"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:h74F2thphk/RBwsJrfiMrmkQfw0= sha256:CTtHvsOio+sxCLUIX1l/pYn3fgBvBmNGulHer7kcZ34= sha1:ITLNbxjelAI9GwTYe2Qv/L1O0zE= sha256:cirOQFpbemAZNCNdPUOB+ZH1U3Q8y2J9N8kC72FvBfA= 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 4144F114DE0; Tue, 17 Nov 2026 03:23:42 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.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 jlmVa8zx1d4D; Tue, 17 Nov 2026 03:23:38 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364854-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 76CA8114DDE; Tue, 17 Nov 2026 03:23:30 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 8360434A78; Tue, 17 Nov 2026 00:22:58 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794874978; b=UdilGIqOTA8L2uV+CFvIJsAeUakODoxL3wgvJYq8HHA8zAQjCfjWI5J/cl5ozlf/4zCA A9tZmEaazTQX2irwVpITMmoxKo0Evj6jmjU+TCRF8DcFeCHT3azsw9sHdztyvXanaLOIC nGwuuNueysXd7AjoiqaGBO8TdGw4H1oR67OP5wgc0tGNF4+1uYL2eFkUMlUqp49obKF2g I9bRD8mtl8J6U6hR/LlrKwyVIJ3QybIZdnl3Kl+/6OvVrZCeYUDe4k1DiXLbpcnj9dpUa 4rjt4UHCAYVfWTToyEDWq6G/bUA7EIUQmrTfAK/QRn3lsLyldNVQJg7fPqSm545hRpg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794874978; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=s3ohfzjwBrYVWyD7nMXcGy5TMW1X4opNptJQOtW8jLU=; b=mVaHI2WUXbQT+NVvNnEmWTUTe8wNcvog1+cq4jjrZBwTJ9hCarwgwkU9CPqcPsDtJdJF aeuq8ilJmkPlnDjS6CMojy/mMgOag96ngXO8mQeMvUpn4tkWcU8veivDHNFwv/+ZoqTmL AczH+OGl7rUoeI9UxyxK7uv/rM4spkzCUwz0tx/oOJ/1xgs3m7ZUIFL7hD2GIpQPmLBQF X001th00l/cec3Hpm1bfH9kK7qBAEun8ll0VpuOisvkVqHV3TccI5HQijlI88+z7NmeUa IVm+nCn33lq1ORi8lcW/dFDLw5zeC34O5+jFQPd0XqCcbJ6WfOGzOOp+eE9iGuxWfhQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DHd3mONO; arc=pass header.oldest-pass=0 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 5738C606A32F; Tue, 17 Nov 2026 00:22:58 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DHd3mONO X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794874972; b=ols9TXW1HHfkaQ65dj+pEag44/t2ypim8WwX9C9z9vFKPq/4xbzahT/iPAo60jzoPq1F J2kSWN2Sp6K2P76HGFE0s+6eNdD9Knhug9SwE5p7NJEMt79eQTIMGmi5RkXx8Hb/uEkYw 9+kWtiulIk1QizFG3SDI6qaNjWQUYbvdv99WnjElFR5GJowACmXdzWhFlVgcKnGcOMitP 2Bw/KVDHu7hgPEzmYNvjPdjN5RhASUB9cyhTbdLIml+RNRC7lO6p3mcxbDm1b/FwuELLh AUMoBLcCdjDOuKnl1oyATefjarcjwex5m60Kiz8UoSjc+MWC/UFRNDxIfbJIHG0TVUg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794874972; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=s3ohfzjwBrYVWyD7nMXcGy5TMW1X4opNptJQOtW8jLU=; b=UAaLe/TUeSp60SIuRa2hHfji4EwBipO8SnL0K73wF/BOxxWP3hXUW+p6dT08Mo4+D9i4 tOCDZhZXe8coXgvd3JNjTi3X5E95Y+BJo3Kggj59u+7ICAfms3d2mkqp3f37G4jEsCm+Q 00yHkO4prlcLTB2uOR/5wz+4VkNiuyYURczh+9zI+t5YSuubdhLV5FRyf5RllVM9c1oDW jmX3dluke0vHaAEjI9vLGcStIX79mgAkGHMDI5kD15m9lnNPcMDUzq405HZ3p00W17wlb rpjjvAdO6ZlwQAkKKptgWyn8ct6l39npEC7Gs3oicOkdZRyh7JjeIQ8nqmk7SFioM0A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DHd3mONO; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 73708606A329; Tue, 17 Nov 2026 00:22:52 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E28A1F000C8; Tue, 17 Nov 2026 00:22:51 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794874972; bh=s3ohfzjwBrYVWyD7nMXcGy5TMW1X4opNptJQOtW8jLU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=DHd3mONOryG/hmWDdnUZeGK2eqFqNo8zo7l8NY0tDY8VMQlwvi4rY5tdbp9qbFMWQ /O5ZjVQ6meAvLCT5tqfmfZMchKHr0x7/SAcTXSzK/BrsLyNbh938cu54s1b/qzB2Gp 9vzfuaBHN6660Flc/NXEUrAD5cYgcSwYteDiqDQgkc8EpEYzzZLQKWyb3Vzh0uvJgb rn70WVf0E7rOnNmyE3AkjIa4P908Fs1s1xYtCNZ5MlUtZML2lCs9h4CWDHV3kwgXUv LUorCu98kDkrwodxDJdTV1fB6x4d1Dyfs7ngr/lkk3r7rqHX/7t5onDQr7uECbRlQ5 C3IFGppAryY0Q== X-Cc: netfilter-devel@vger.kernel.org, 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-In-Reply-To: <20261116001612.2806263-8-pablo@netfilter.org> X-sashiko-severity: Low 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