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: <20251221093038.GG13030@unreal>
Date: Sun, 21 Dec 2025 11:30:38 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Jang Ingyu <ingyujang25@...ea.ac.kr>
Cc: jgg@...pe.ca, linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] infiniband/core: Fix logic error in
 ib_get_gids_from_rdma_hdr()

On Sun, Dec 21, 2025 at 11:24:18AM +0200, Leon Romanovsky wrote:
> On Fri, Dec 19, 2025 at 01:15:08PM +0900, Jang Ingyu wrote:
> > Fix missing comparison operator for RDMA_NETWORK_ROCE_V1 in the
> > conditional statement. The constant was used directly instead of
> > being compared with net_type, causing the condition to always
> > evaluate to true.
> 
> In current code, it doesn't matter as network type can be one of four
> possible values, and this "else if" will be always true anyway.
> 
> I changed your patch to this and added Fixes line:
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index ee390928511ae..256f81c5803ff 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -737,14 +737,11 @@ int ib_get_gids_from_rdma_hdr(const union rdma_network_hdr *hdr,
>                 ipv6_addr_set_v4mapped(dst_saddr,
>                                        (struct in6_addr *)dgid);
>                 return 0;
> -       } else if (net_type == RDMA_NETWORK_IPV6 ||
> -                  net_type == RDMA_NETWORK_IB || net_type == RDMA_NETWORK_ROCE_V1) {
> -               *dgid = hdr->ibgrh.dgid;
> -               *sgid = hdr->ibgrh.sgid;
> -               return 0;
> -       } else {
> -               return -EINVAL;
>         }
> +
> +       *dgid = hdr->ibgrh.dgid;
> +       *sgid = hdr->ibgrh.sgid;
> +       return 0;
>  }
>  EXPORT_SYMBOL(ib_get_gids_from_rdma_hdr);

After some additional consideration, I'll keep your patch as is.

My change is technically correct, but it's risky since some drivers  
use non‑conformant values.

Thanks.

> 
> > 
> > Signed-off-by: Jang Ingyu <ingyujang25@...ea.ac.kr>
> > ---
> >  drivers/infiniband/core/verbs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> > index 11b1a194d..ee3909285 100644
> > --- a/drivers/infiniband/core/verbs.c
> > +++ b/drivers/infiniband/core/verbs.c
> > @@ -738,7 +738,7 @@ int ib_get_gids_from_rdma_hdr(const union rdma_network_hdr *hdr,
> >  				       (struct in6_addr *)dgid);
> >  		return 0;
> >  	} else if (net_type == RDMA_NETWORK_IPV6 ||
> > -		   net_type == RDMA_NETWORK_IB || RDMA_NETWORK_ROCE_V1) {
> > +		   net_type == RDMA_NETWORK_IB || net_type == RDMA_NETWORK_ROCE_V1) {
> >  		*dgid = hdr->ibgrh.dgid;
> >  		*sgid = hdr->ibgrh.sgid;
> >  		return 0;
> > -- 
> > 2.34.1
> > 
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ