Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: Li Xiasong <lixiasong1@huawei.com>,
	netfilter-devel@vger.kernel.org, stable@vger.kernel.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 16:50:19 +0200	[thread overview]
Message-ID: <aftVK8KkCzQrsiAD@chamomile> (raw)
In-Reply-To: <aftDGCXcI45PdHQc@strlen.de>

On Wed, May 06, 2026 at 03:33:12PM +0200, Florian Westphal wrote:
> 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.

Agreed.

  reply	other threads:[~2026-05-06 14:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260506121618.578443-1-lixiasong1@huawei.com>
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
2026-05-06 14:50     ` Pablo Neira Ayuso [this message]
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=aftVK8KkCzQrsiAD@chamomile \
    --to=pablo@netfilter.org \
    --cc=coreteam@netfilter.org \
    --cc=fw@strlen.de \
    --cc=lixiasong1@huawei.com \
    --cc=netfilter-devel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox