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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180312154019.GB7457@hmswarspite.think-freely.org>
Date:   Mon, 12 Mar 2018 11:40:19 -0400
From:   Neil Horman <nhorman@...driver.com>
To:     Wei Yongjun <weiyongjun1@...wei.com>
Cc:     Vlad Yasevich <vyasevich@...il.com>,
        Xin Long <lucien.xin@...il.com>, linux-sctp@...r.kernel.org,
        netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net-next] sctp: fix error return code in
 sctp_sendmsg_new_asoc()

On Mon, Mar 12, 2018 at 12:16:04PM +0000, Wei Yongjun wrote:
> Return error code -EINVAL in the address len check error handling
> case since 'err' can be overwrite to 0 by 'err = sctp_verify_addr()'
> in the for loop.
> 
> Fixes: 2c0dbaa0c43d ("sctp: add support for SCTP_DSTADDRV4/6 Information for sendmsg")
> Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
> ---
>  net/sctp/socket.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 7d3476a..5e7bfc2 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -1761,16 +1761,20 @@ static int sctp_sendmsg_new_asoc(struct sock *sk, __u16 sflags,
>  		memset(daddr, 0, sizeof(*daddr));
>  		dlen = cmsg->cmsg_len - sizeof(struct cmsghdr);
>  		if (cmsg->cmsg_type == SCTP_DSTADDRV4) {
> -			if (dlen < sizeof(struct in_addr))
> +			if (dlen < sizeof(struct in_addr)) {
> +				err = -EINVAL;
>  				goto free;
> +			}
>  
>  			dlen = sizeof(struct in_addr);
>  			daddr->v4.sin_family = AF_INET;
>  			daddr->v4.sin_port = htons(asoc->peer.port);
>  			memcpy(&daddr->v4.sin_addr, CMSG_DATA(cmsg), dlen);
>  		} else {
> -			if (dlen < sizeof(struct in6_addr))
> +			if (dlen < sizeof(struct in6_addr)) {
> +				err = -EINVAL;
>  				goto free;
> +			}
>  
>  			dlen = sizeof(struct in6_addr);
>  			daddr->v6.sin6_family = AF_INET6;
> 
> 
Acked-by: Neil Horman <nhorman@...driver.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ