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]
Date:   Tue, 23 Nov 2021 11:11:51 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Håkon Bugge <haakon.bugge@...cle.com>
Cc:     Doug Ledford <dledford@...hat.com>, Jason Gunthorpe <jgg@...pe.ca>,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH for-rc] RDMA/cma: Remove open coding for overflow in
 cma_connect_ib

On Mon, Nov 22, 2021 at 05:48:53PM +0100, Håkon Bugge wrote:
> The existing test is a little hard to comprehend. Use
> check_add_overflow() instead.
> 
> Fixes: 04ded1672402 ("RDMA/cma: Verify private data length")
> Signed-off-by: Håkon Bugge <haakon.bugge@...cle.com>
> ---
>  drivers/infiniband/core/cma.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index 835ac54..0435768 100644
> --- a/drivers/infiniband/core/cma.c
> +++ b/drivers/infiniband/core/cma.c
> @@ -4093,8 +4093,7 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
>  
>  	memset(&req, 0, sizeof req);
>  	offset = cma_user_data_offset(id_priv);
> -	req.private_data_len = offset + conn_param->private_data_len;
> -	if (req.private_data_len < conn_param->private_data_len)
> +	if (check_add_overflow(offset, conn_param->private_data_len, &req.private_data_len))
>  		return -EINVAL;

The same check exists in cma_resolve_ib_udp too.

Thanks

>  
>  	if (req.private_data_len) {
> -- 
> 1.8.3.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ