Do you need to check it twice? Is the second test now redundant?
-Philip On Nov 13, 2013, at 10:28 PM, Somnath Kotur <[email protected]> wrote: > Even if the addr is not a linklocal address, the code treats it as such > and assigns the bound dev addr to the scope id of the address which is > invalid. > Fix by checking if it's a link local address first and return 0 if not. > > Signed-off-by: Somnath Kotur <[email protected]> > --- > drivers/infiniband/core/cma.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c > index dab4b41..5c9f1ad 100644 > --- a/drivers/infiniband/core/cma.c > +++ b/drivers/infiniband/core/cma.c > @@ -2466,6 +2466,9 @@ static int cma_check_linklocal(struct rdma_dev_addr > *dev_addr, > return 0; > > sin6 = (struct sockaddr_in6 *) addr; > + > + if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)) > + return 0; > if ((ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) && > !sin6->sin6_scope_id) > return -EINVAL; > -- > 1.7.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
