From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nf-next] netfilter: flowtable: do not hw offload flows in teardown state
Date: Fri, 16 Oct 2026 10:52:01 +0200 [thread overview]
Message-ID: <20261016085202.1670076-1-pablo@netfilter.org> (raw)
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
next reply other threads:[~2026-10-16 8:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 8:52 Pablo Neira Ayuso [this message]
2026-10-16 16:35 ` [syzbot ci] Re: netfilter: flowtable: do not hw offload flows in teardown state syzbot ci
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261016085202.1670076-1-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.