FW: [PATCH v1] IB/CMA: Fix to handle global/non-linklocal IPv6 address in cma_check_linklocal()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Roland,
            It's been a couple of months since I posted this, could you please apply this patch and/or respond ? 

Thanks
Som

-----Original Message-----
From: linux-rdma-owner@xxxxxxxxxxxxxxx [mailto:linux-rdma-owner@xxxxxxxxxxxxxxx] On Behalf Of Somnath Kotur
Sent: Saturday, November 16, 2013 9:30 AM
To: roland@xxxxxxxxxx
Cc: linux-rdma@xxxxxxxxxxxxxxx; Somnath Kotur
Subject: [PATCH v1] IB/CMA: Fix to handle global/non-linklocal IPv6 address in cma_check_linklocal()

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 <somnath.kotur@xxxxxxxxxx>
---
Incorporated comments from Philip and Sean Hefty.

 drivers/infiniband/core/cma.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index dab4b41..7f8ee93 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2466,8 +2466,11 @@ 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) &&
-	    !sin6->sin6_scope_id)
+
+	if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
+		return 0;
+
+	if (!sin6->sin6_scope_id)
 			return -EINVAL;
 
 	dev_addr->bound_dev_if = sin6->sin6_scope_id;
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux