Skip to contentSkip to conversation

IB/cma: Family of destination address should be equal to family of source address

PATCH Applied Leon Romanovsky 2 participants 2 messages Feb 14, 2017 – Feb 15, 2017 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/cma: Family of destination address should be equal to family of source address

From: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/[email protected]>

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")
---
 drivers/infiniband/core/cma.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/infiniband/core/cma.c +4 -0
index 3e70a9c5d79d..8a7e2b041a94 100644
@@ -3205,6 +3205,7 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
 {
 	struct rdma_id_private *id_priv;
 	int ret;
+	struct sockaddr  *daddr;
 
 	if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6 &&
 	    addr->sa_family != AF_IB)
@@ -3244,6 +3245,9 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
 	if (ret)
 		goto err2;
 
+	daddr = cma_dst_addr(id_priv);
+	daddr->sa_family = addr->sa_family;
+
 	return 0;
 err2:
 	if (id_priv->cma_dev)

--
2.11.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

A message that is not in the archive (sent off-list or not yet received): 20170214052408.16361-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

Applied
#2 lore raw
Quoted 15 lines · Leon Romanovsky

From: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/[email protected]>

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()).

Quoted 6 lines

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")

Thanks, applied.

Signature · 4 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD