netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: gfree.wind@foxmail.com
Cc: netfilter-devel@vger.kernel.org, Gao Feng <fgao@ikuai8.com>
Subject: Re: [PATCH nf v2 1/1] netfilter: xt_CT: Fix one possible memleak of timeout
Date: Fri, 14 Apr 2017 00:24:46 +0200	[thread overview]
Message-ID: <20170413222446.GA4978@salvia> (raw)
In-Reply-To: <1491477574-82700-1-git-send-email-gfree.wind@foxmail.com>

On Thu, Apr 06, 2017 at 07:19:34PM +0800, gfree.wind@foxmail.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
> 
> When nf_ct_timeout_ext_add failed in xt_ct_set_timeout, it should
> free the timeout refcnt.
> 
> Now goto the err_put_timeout error handler instead of going ahead.
> 
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
>  v2: Keep the ret = -ENOMEM, per Gao Feng
>  v1: initial version
> 
>  net/netfilter/xt_CT.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
> index b008db0..a1783b6 100644
> --- a/net/netfilter/xt_CT.c
> +++ b/net/netfilter/xt_CT.c
> @@ -167,8 +167,10 @@ static void __xt_ct_tg_timeout_put(struct ctnl_timeout *timeout)
>  		goto err_put_timeout;
>  	}
>  	timeout_ext = nf_ct_timeout_ext_add(ct, timeout, GFP_ATOMIC);
> -	if (timeout_ext == NULL)
> +	if (!timeout_ext) {
>  		ret = -ENOMEM;
> +		goto err_put_timeout;
> +	}

This also needs to be fixed, just a few line after this:

        timeout_ext = nf_ct_timeout_ext_add(ct, timeout, GFP_ATOMIC);
        if (timeout_ext == NULL)
                ret = -ENOMEM;

      reply	other threads:[~2017-04-13 22:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 11:19 [PATCH nf v2 1/1] netfilter: xt_CT: Fix one possible memleak of timeout gfree.wind
2017-04-13 22:24 ` Pablo Neira Ayuso [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=20170413222446.GA4978@salvia \
    --to=pablo@netfilter.org \
    --cc=fgao@ikuai8.com \
    --cc=gfree.wind@foxmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).