aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoni Shoua <monis@mellanox.com>2017-02-14 00:24:08 -0500
committerDoug Ledford <dledford@redhat.com>2017-02-15 09:51:33 -0500
commit6df6b4a9ce43deb57d3e23b0e79a529464b5cf37 (patch)
tree19ce9fea715e0a7aa66e97e796cad6aefbf61a46
parent89052d784bc977c2a0b92393f6bd57140952c206 (diff)
IB/cma: Destination and source addr families must match
The destination address in a listening rdma_id does not have an address family. Since address family in both sides of a connection must be the same in rdma_bind_addr() we set the address family of the destination to the address family of the source. This patch serves the logic in cma_port_is_unique() which requires to know if destination address that is associated with a rdma_id is any address (cma_zero_addr() and cma_loopback_addr()). This can happen when port reuse is checked for a port number that is being listened to. Fixes: 19b752a19dce ("IB/cma: Allow port reuse for rdma_id") Signed-off-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/core/cma.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index f98ec19a851a..ba60e4b5114c 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -3297,6 +3297,7 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
3297{ 3297{
3298 struct rdma_id_private *id_priv; 3298 struct rdma_id_private *id_priv;
3299 int ret; 3299 int ret;
3300 struct sockaddr *daddr;
3300 3301
3301 if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6 && 3302 if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6 &&
3302 addr->sa_family != AF_IB) 3303 addr->sa_family != AF_IB)
@@ -3336,6 +3337,9 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
3336 if (ret) 3337 if (ret)
3337 goto err2; 3338 goto err2;
3338 3339
3340 daddr = cma_dst_addr(id_priv);
3341 daddr->sa_family = addr->sa_family;
3342
3339 return 0; 3343 return 0;
3340err2: 3344err2:
3341 if (id_priv->cma_dev) 3345 if (id_priv->cma_dev)