All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Li Xiasong <lixiasong1@huawei.com>
Cc: netfilter-devel@vger.kernel.org, stable@vger.kernel.org,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Phil Sutter <phil@nwl.cc>,
	coreteam@netfilter.org, yuehaibing@huawei.com,
	zhangchangzhong@huawei.com, weiyongjun1@huawei.com
Subject: Re: [PATCH nft 1/2] netfilter: nf_conntrack_sip: fix missing expect put in REGISTER path
Date: Wed, 6 May 2026 15:33:12 +0200	[thread overview]
Message-ID: <aftDGCXcI45PdHQc@strlen.de> (raw)
In-Reply-To: <20260506121618.578443-2-lixiasong1@huawei.com>

Li Xiasong <lixiasong1@huawei.com> wrote:
> process_register_request() allocates an expectation, but the !helper
> error path returns NF_DROP without nf_ct_expect_put(exp).
> 
> Add the missing put to balance nf_ct_expect_alloc() on this path.
> 
> Fixes: e14575fa7529 ("netfilter: nf_conntrack: use rcu accessors where needed")
> Cc: stable@vger.kernel.org
> Signed-off-by: Li Xiasong <lixiasong1@huawei.com>
> ---
>  net/netfilter/nf_conntrack_sip.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
> index 1eb55907d470..a895bc836e1b 100644
> --- a/net/netfilter/nf_conntrack_sip.c
> +++ b/net/netfilter/nf_conntrack_sip.c
> @@ -1377,8 +1377,10 @@ static int process_register_request(struct sk_buff *skb, unsigned int protoff,
>  		saddr = &ct->tuplehash[!dir].tuple.src.u3;
>  
>  	helper = rcu_dereference(nfct_help(ct)->helper);
> -	if (!helper)
> +	if (!helper) {
> +		nf_ct_expect_put(exp);
>  		return NF_DROP;
> +	}

I think it would be simpler to move the rcu defer to before
exp allocation instead.

  reply	other threads:[~2026-05-06 13:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 12:16 [PATCH nft 0/2] netfilter: fix nf_ct_expect_alloc() reference leaks Li Xiasong
2026-05-06 12:16 ` [PATCH nft 1/2] netfilter: nf_conntrack_sip: fix missing expect put in REGISTER path Li Xiasong
2026-05-06 13:33   ` Florian Westphal [this message]
2026-05-06 14:50     ` Pablo Neira Ayuso
2026-05-06 12:16 ` [PATCH nft 2/2] netfilter: nft_ct: fix missing expect put in obj eval Li Xiasong

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=aftDGCXcI45PdHQc@strlen.de \
    --to=fw@strlen.de \
    --cc=coreteam@netfilter.org \
    --cc=lixiasong1@huawei.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=stable@vger.kernel.org \
    --cc=weiyongjun1@huawei.com \
    --cc=yuehaibing@huawei.com \
    --cc=zhangchangzhong@huawei.com \
    /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.