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, 7 Dec 2021 14:44:10 -0400
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Leon Romanovsky <leon@...nel.org>
Cc:     Doug Ledford <dledford@...hat.com>,
        Avihai Horon <avihaih@...dia.com>,
        linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
        Mark Zhang <markzhang@...dia.com>
Subject: Re: [PATCH rdma-next 3/3] RDMA/cma: Let cma_resolve_ib_dev()
 continue search even after empty entry

On Mon, Nov 22, 2021 at 01:53:58PM +0200, Leon Romanovsky wrote:
> From: Avihai Horon <avihaih@...dia.com>
> 
> Currently, when cma_resolve_ib_dev() searches for a matching GID it will
> stop searching after encountering the first empty GID table entry. This
> behavior is wrong since neither IB nor RoCE spec enforce tightly packed
> GID tables.
> 
> For example, when the matching valid GID entry exists at index N, and if
> a GID entry is empty at index N-1, cma_resolve_ib_dev() will fail to
> find the matching valid entry.
> 
> Fix it by making cma_resolve_ib_dev() continue searching even after
> encountering missing entries.
> 
> Fixes: f17df3b0dede ("RDMA/cma: Add support for AF_IB to rdma_resolve_addr()")
> Signed-off-by: Avihai Horon <avihaih@...dia.com>
> Reviewed-by: Mark Zhang <markzhang@...dia.com>
> Signed-off-by: Leon Romanovsky <leonro@...dia.com>
>  drivers/infiniband/core/cma.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index 835ac54d4a24..b669002c9255 100644
> +++ b/drivers/infiniband/core/cma.c
> @@ -766,6 +766,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
>  	unsigned int p;
>  	u16 pkey, index;
>  	enum ib_port_state port_state;
> +	int ret;
>  	int i;
>  
>  	cma_dev = NULL;
> @@ -784,9 +785,16 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
>  
>  			if (ib_get_cached_port_state(cur_dev->device, p, &port_state))
>  				continue;
> -			for (i = 0; !rdma_query_gid(cur_dev->device,
> -						    p, i, &gid);
> -			     i++) {
> +
> +			for (i = 0; i < cur_dev->device->port_data[p].immutable.gid_tbl_len;
> +			     ++i) {
> +				ret = rdma_query_gid(cur_dev->device, p, i,
> +						     &gid);
> +				if (ret == -ENOENT)
> +					continue;
> +				if (ret)
> +					break;

Same here, just always continue

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ