lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1522777564.2654.115.camel@codethink.co.uk>
Date:   Tue, 03 Apr 2018 18:46:04 +0100
From:   Ben Hutchings <ben.hutchings@...ethink.co.uk>
To:     Gao Feng <fgao@...ai8.com>, Liping Zhang <zlpnobody@...il.com>,
        Pablo Neira Ayuso <pablo@...filter.org>
Cc:     stable@...r.kernel.org,
        Sasha Levin <alexander.levin@...rosoft.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4.4 38/97] netfilter: xt_CT: fix refcnt leak on error
 path

On Fri, 2018-03-23 at 10:54 +0100, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Gao Feng <fgao@...ai8.com>
> 
> 
> [ Upstream commit 470acf55a021713869b9bcc967268ac90c8a0fac ]
[...]
> --- a/net/netfilter/xt_CT.c
> +++ b/net/netfilter/xt_CT.c
> @@ -168,8 +168,10 @@ xt_ct_set_timeout(struct nf_conn *ct, co
>  		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;
> +	}
>  
>  	rcu_read_unlock();
>  	return ret;

This part looks fine.

> @@ -201,6 +203,7 @@ static int xt_ct_tg_check(const struct x
> >  			  struct xt_ct_target_info_v1 *info)
>  {
>  	struct nf_conntrack_zone zone;
> +	struct nf_conn_help *help;
>  	struct nf_conn *ct;
>  	int ret = -EOPNOTSUPP;
>  
> @@ -249,7 +252,7 @@ static int xt_ct_tg_check(const struct x
>  	if (info->timeout[0]) {
>  		ret = xt_ct_set_timeout(ct, par, info->timeout);
>  		if (ret < 0)
> -			goto err3;
> +			goto err4;
>  	}
>  	__set_bit(IPS_CONFIRMED_BIT, &ct->status);
>  	nf_conntrack_get(&ct->ct_general);
> @@ -257,6 +260,10 @@ out:
>  	info->ct = ct;
>  	return 0;
>  
> +err4:
> +	help = nfct_help(ct);
> +	if (help)
> +		module_put(help->helper->me);
>  err3:
>  	nf_ct_tmpl_free(ct);
>  err2:

This does not.  nf_ct_tmpl_free() calls nf_ct_ext_destroy() which I
think will call back into xt_ct_tg_destroy().  So I think the module
reference is already dropped here and we mustn't do it twice.  Am I
missing something?

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ