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: <8636fc9a-001a-9d48-087b-7f243527cd99@huawei.com>
Date:   Thu, 23 Apr 2020 14:36:51 +0800
From:   Yuehaibing <yuehaibing@...wei.com>
To:     Xiyu Yang <xiyuyang19@...an.edu.cn>,
        Andrew Hendry <andrew.hendry@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        "Jakub Kicinski" <kuba@...nel.org>,
        Martin Schiller <ms@....tdt.de>,
        Eric Dumazet <edumazet@...gle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        <linux-x25@...r.kernel.org>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
CC:     <yuanxzhang@...an.edu.cn>, <kjlu@....edu>,
        Xin Tan <tanxin.ctf@...il.com>
Subject: Re: [PATCH 1/2] net/x25: Fix x25_neigh refcnt leak when x25_connect()
 fails

On 2020/4/23 13:13, Xiyu Yang wrote:
> x25_connect() invokes x25_get_neigh(), which returns a reference of the
> specified x25_neigh object to "x25->neighbour" with increased refcnt.
> 
> When x25_connect() returns, local variable "x25" and "x25->neighbour"
> become invalid, so the refcount should be decreased to keep refcount
> balanced.
> 
> The reference counting issue happens in one exception handling path of
> x25_connect(). When sock state is not TCP_ESTABLISHED and its flags
> include O_NONBLOCK, the function forgets to decrease the refcnt
> increased by x25_get_neigh(), causing a refcnt leak.
> 
> Fix this issue by jumping to "out_put_neigh" label when x25_connect()
> fails.
> 
> Signed-off-by: Xiyu Yang <xiyuyang19@...an.edu.cn>
> Signed-off-by: Xin Tan <tanxin.ctf@...il.com>
> ---
>  net/x25/af_x25.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
> index d5b09bbff375..e6571c56209b 100644
> --- a/net/x25/af_x25.c
> +++ b/net/x25/af_x25.c
> @@ -816,7 +816,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr,
>  	/* Now the loop */
>  	rc = -EINPROGRESS;
>  	if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK))
> -		goto out;
> +		goto out_put_neigh;

This seems not right, see

commit e21dba7a4df4 ("net/x25: fix nonblocking connect")

>  
>  	rc = x25_wait_for_connection_establishment(sk);
>  	if (rc)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ