* [PATCH 4/3 nf,v4] netfilter: nf_conntrack_helper: call .destroy() when helper is unregistered
@ 2026-05-18 19:47 Pablo Neira Ayuso
2026-05-18 22:17 ` Florian Westphal
0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2026-05-18 19:47 UTC (permalink / raw)
To: netfilter-devel
When the helper is removed, call .destroy to release the pptp binding
with gre conntrack entries, otherwise the gre keymap stays with stale
list entries.
Fixes: f09943fefe6b ("[NETFILTER]: nf_conntrack/nf_nat: add PPTP helper port")
Reported-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nf_conntrack_helper.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 9a10b3449957..b226291a5c7f 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -241,9 +241,17 @@ EXPORT_SYMBOL_GPL(__nf_ct_try_assign_helper);
static int unhelp(struct nf_conn *ct, void *me)
{
struct nf_conn_help *help = nfct_help(ct);
+ struct nf_conntrack_helper *helper;
+
+ if (!help)
+ return 0;
- if (help && rcu_dereference_raw(help->helper) == me) {
+ helper = rcu_dereference_raw(help->helper);
+ if (helper == me) {
nf_conntrack_event(IPCT_HELPER, ct);
+ if (helper->destroy)
+ helper->destroy(ct);
+
RCU_INIT_POINTER(help->helper, NULL);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 4/3 nf,v4] netfilter: nf_conntrack_helper: call .destroy() when helper is unregistered
2026-05-18 19:47 [PATCH 4/3 nf,v4] netfilter: nf_conntrack_helper: call .destroy() when helper is unregistered Pablo Neira Ayuso
@ 2026-05-18 22:17 ` Florian Westphal
2026-05-19 8:03 ` Pablo Neira Ayuso
0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2026-05-18 22:17 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> When the helper is removed, call .destroy to release the pptp binding
> with gre conntrack entries, otherwise the gre keymap stays with stale
> list entries.
>
> Fixes: f09943fefe6b ("[NETFILTER]: nf_conntrack/nf_nat: add PPTP helper port")
> Reported-by: Florian Westphal <fw@strlen.de>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> net/netfilter/nf_conntrack_helper.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
> index 9a10b3449957..b226291a5c7f 100644
> --- a/net/netfilter/nf_conntrack_helper.c
> +++ b/net/netfilter/nf_conntrack_helper.c
> @@ -241,9 +241,17 @@ EXPORT_SYMBOL_GPL(__nf_ct_try_assign_helper);
> static int unhelp(struct nf_conn *ct, void *me)
> {
> struct nf_conn_help *help = nfct_help(ct);
> + struct nf_conntrack_helper *helper;
> +
> + if (!help)
> + return 0;
>
> - if (help && rcu_dereference_raw(help->helper) == me) {
> + helper = rcu_dereference_raw(help->helper);
> + if (helper == me) {
> nf_conntrack_event(IPCT_HELPER, ct);
> + if (helper->destroy)
> + helper->destroy(ct);
> +
There is a nf_ct_helper_destroy() helper that could be used here instead
of open-coding. Other than that this looks correct.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 4/3 nf,v4] netfilter: nf_conntrack_helper: call .destroy() when helper is unregistered
2026-05-18 22:17 ` Florian Westphal
@ 2026-05-19 8:03 ` Pablo Neira Ayuso
0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2026-05-19 8:03 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
On Tue, May 19, 2026 at 12:17:56AM +0200, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > When the helper is removed, call .destroy to release the pptp binding
> > with gre conntrack entries, otherwise the gre keymap stays with stale
> > list entries.
> >
> > Fixes: f09943fefe6b ("[NETFILTER]: nf_conntrack/nf_nat: add PPTP helper port")
> > Reported-by: Florian Westphal <fw@strlen.de>
> > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> > ---
> > net/netfilter/nf_conntrack_helper.c | 10 +++++++++-
> > 1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
> > index 9a10b3449957..b226291a5c7f 100644
> > --- a/net/netfilter/nf_conntrack_helper.c
> > +++ b/net/netfilter/nf_conntrack_helper.c
> > @@ -241,9 +241,17 @@ EXPORT_SYMBOL_GPL(__nf_ct_try_assign_helper);
> > static int unhelp(struct nf_conn *ct, void *me)
> > {
> > struct nf_conn_help *help = nfct_help(ct);
> > + struct nf_conntrack_helper *helper;
> > +
> > + if (!help)
> > + return 0;
> >
> > - if (help && rcu_dereference_raw(help->helper) == me) {
> > + helper = rcu_dereference_raw(help->helper);
> > + if (helper == me) {
> > nf_conntrack_event(IPCT_HELPER, ct);
> > + if (helper->destroy)
> > + helper->destroy(ct);
> > +
>
> There is a nf_ct_helper_destroy() helper that could be used here instead
> of open-coding. Other than that this looks correct.
Yes, but it is refetching the helper again which seems redundant to
me. I can use it if you prefer though.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-19 8:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18 19:47 [PATCH 4/3 nf,v4] netfilter: nf_conntrack_helper: call .destroy() when helper is unregistered Pablo Neira Ayuso
2026-05-18 22:17 ` Florian Westphal
2026-05-19 8:03 ` Pablo Neira Ayuso
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.