Netdev List
 help / color / mirror / Atom feed
From: Qican Ma <goonsomeway@gmail.com>
To: pablo@netfilter.org
Cc: fw@strlen.de, phil@nwl.cc, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, netfilter-devel@vger.kernel.org,
	coreteam@netfilter.org, netdev@vger.kernel.org
Subject: Re: [PATCH nf v2] netfilter: flowtable: interlock NF_FLOW_TEARDOWN with NF_FLOW_PENDING
Date: Wed, 25 Nov 2026 15:22:19 +0800	[thread overview]
Message-ID: <179559133958.36524.598452056230313951@gmail.com> (raw)
In-Reply-To: <awWMcRVhzciy1gIw@chamomile>

Hi Pablo,

No - my tree is based on v7.4-rc4 mainline, which does not have
0abb54363974 yet.

I have now stack-tested my patch on top of your commit on net-next:
all hunks apply cleanly, and the two changes complement each other.

Your commit rechecks NF_FLOW_TEARDOWN in the nf_flow_offload_refresh()
caller after nf_flow_offload_work_alloc(). My patch performs the same
check inside nf_flow_offload_work_alloc() for all FLOW_CLS_REPLACE
callers, which covers nf_flow_offload_refresh() and also the
flow_offload_add() path, and bails before the kmalloc.

The other half of my patch adds the GC-side interlock that is still
missing: gc_step() reads NF_FLOW_PENDING at function entry, before
flow_offload_teardown() sets NF_FLOW_TEARDOWN later in the same pass.
Without the barrier the following interleaving still frees the flow via
RCU while a work item is queued on it:

  GC reads PENDING=0 -> refresh sets PENDING and reads TEARDOWN=0 ->
  queues work -> GC sets TEARDOWN -> flow_offload_del()

I will rebase onto net-next with your commit included and send v3.
Your refresh-side check still works as a second-chance bail there, or
it can be folded into the work_alloc-side check - whichever you prefer.

Thanks,
Qican Ma

      reply	other threads:[~2026-11-25  7:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  7:54 [PATCH nf v2] netfilter: flowtable: interlock NF_FLOW_TEARDOWN with NF_FLOW_PENDING Qican Ma
2026-11-24 13:09 ` Pablo Neira Ayuso
2026-11-25  7:22   ` Qican Ma [this message]

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=179559133958.36524.598452056230313951@gmail.com \
    --to=goonsomeway@gmail.com \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox