diff options
author | Somnath Kotur <somnath.kotur@emulex.com> | 2013-11-15 23:00:01 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-01-23 01:49:17 -0500 |
commit | 5462eddd7a78131ccb514d52473625d99769215e (patch) | |
tree | 369a593837786ab8f5e437415057337bc602ed47 | |
parent | 7e22e91102c6b9df7c4ae2168910e19d2bb14cd6 (diff) |
RDMA/cma: Handle global/non-linklocal IPv6 addresses in cma_check_linklocal()
If addr is not a linklocal address, the code incorrectly fails to
return and ends up assigning the scope ID to the scope id of the
address, which is wrong. Fix by checking if it's a link local address
first, and immediately return 0 if not.
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | 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 8e49db690f33..4173a2ad6d08 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -2480,8 +2480,11 @@ static int cma_check_linklocal(struct rdma_dev_addr *dev_addr, | |||
2480 | return 0; | 2480 | return 0; |
2481 | 2481 | ||
2482 | sin6 = (struct sockaddr_in6 *) addr; | 2482 | sin6 = (struct sockaddr_in6 *) addr; |
2483 | if ((ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) && | 2483 | |
2484 | !sin6->sin6_scope_id) | 2484 | if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)) |
2485 | return 0; | ||
2486 | |||
2487 | if (!sin6->sin6_scope_id) | ||
2485 | return -EINVAL; | 2488 | return -EINVAL; |
2486 | 2489 | ||
2487 | dev_addr->bound_dev_if = sin6->sin6_scope_id; | 2490 | dev_addr->bound_dev_if = sin6->sin6_scope_id; |