From: Florian Westphal <fw@strlen.de>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH nf] netfilter: nf_conncount: fix leaked ct in error paths
Date: Thu, 4 Dec 2025 16:27:10 +0100 [thread overview]
Message-ID: <aTGoTkX8IbGjkjxw@strlen.de> (raw)
In-Reply-To: <20251204140124.4376-1-fmancera@suse.de>
Fernando Fernandez Mancera <fmancera@suse.de> wrote:
> There are some situations where ct might be leaked as error paths are
> skipping the refcounted check and return immediately. In order to solve
> it, call nf_ct_put() as soon as possible or make sure that the check is
> always called.
>
> Fixes: be102eb6a0e7 ("netfilter: nf_conncount: rework API to use sk_buff directly")
> Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
> ---
> Note: this is actually rebased in top of net.git
> ---
> net/netfilter/nf_conncount.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c
> index f1be4dd5cf85..09b534fb1b4b 100644
> --- a/net/netfilter/nf_conncount.c
> +++ b/net/netfilter/nf_conncount.c
> @@ -181,6 +181,8 @@ static int __nf_conncount_add(struct net *net,
> nf_ct_put(ct);
> return -EEXIST;
> }
> + if (refcounted)
> + nf_ct_put(ct);
I don't think you can put it this early. Afaics the zone pointer may
point to storage within 'ct', so this has to be deferred or handled
like 'tuple' (copy).
prev parent reply other threads:[~2025-12-04 15:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 14:01 [PATCH nf] netfilter: nf_conncount: fix leaked ct in error paths Fernando Fernandez Mancera
2025-12-04 15:27 ` Florian Westphal [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=aTGoTkX8IbGjkjxw@strlen.de \
--to=fw@strlen.de \
--cc=coreteam@netfilter.org \
--cc=fmancera@suse.de \
--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.