All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: flowtable: do not hw offload flows in teardown state
@ 2026-10-16  8:52 Pablo Neira Ayuso
  2026-10-16 16:35 ` [syzbot ci] " syzbot ci
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2026-10-16  8:52 UTC (permalink / raw)
  To: netfilter-devel

Sashiko reports that refreshing hw offload from packet path is racy
since the flow might be already going away. Refresh the flow instead via
GC worker to address this, ie. if hardware offload fails, next GC run
will give this flow a chance to offload it to hardware.

Since commit 7c549fb7eecd ("netfilter: flowtable: generalize pending
status bit"), GC skips flow entries that are still pending to be
offloaded. Let's just check for the teardown status bit after the
pending bit is set on to address this race.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
Another attempt, aiming at a more simple approach to address the race.

 net/netfilter/nf_flow_table_offload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c
index 5aed013d6468..0473696ddb1d 100644
--- a/net/netfilter/nf_flow_table_offload.c
+++ b/net/netfilter/nf_flow_table_offload.c
@@ -1101,8 +1101,9 @@ nf_flow_offload_work_alloc(struct nf_flowtable *flowtable,
 		return NULL;
 
 	offload = kmalloc_obj(struct flow_offload_work, GFP_ATOMIC);
-	if (!offload) {
+	if (!offload || test_bit(NF_FLOW_TEARDOWN, &flow->flags)) {
 		clear_bit(NF_FLOW_PENDING, &flow->flags);
+		kfree(offload);
 		return NULL;
 	}
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-16 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16  8:52 [PATCH nf-next] netfilter: flowtable: do not hw offload flows in teardown state Pablo Neira Ayuso
2026-10-16 16:35 ` [syzbot ci] " syzbot ci

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.