Skip to contentSkip to conversation

RDMA/ucma: Allow resolving address without specifying source address

PATCH Applied Roland Dreier 2 participants 2 messages Apr 19, 2018 – Apr 20, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/ucma: Allow resolving address without specifying source address

From: Roland Dreier <[email protected]>

The RDMA CM will select a source device and address by consulting the routing table if no source address is passed into rdma_resolve_address(). Userspace will ask for this by passing an all-zero source address in the RESOLVE_IP command. Unfortunately the new check for non-zero address size rejects this with EINVAL, which breaks valid userspace applications.

Fix this by explicitly allowing a zero address family for the source.

Fixes 2975d5de6428 ("RDMA/ucma: Check AF family prior resolving address")
---
 drivers/infiniband/core/ucma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/ucma.c +1 -1
index 74329483af6d..0a7242ce7c1f 100644
@@ -683,7 +683,7 @@ static ssize_t ucma_resolve_ip(struct ucma_file *file,
 	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
 		return -EFAULT;
 
-	if (!rdma_addr_size_in6(&cmd.src_addr) ||
+	if ((cmd.src_addr.sin6_family && !rdma_addr_size_in6(&cmd.src_addr)) ||
 	    !rdma_addr_size_in6(&cmd.dst_addr))
 		return -EINVAL;
 
Signature · 1 line
2.17.0
Applied
#1 lore raw
Quoted 8 lines · Roland Dreier

From: Roland Dreier <[email protected]>

The RDMA CM will select a source device and address by consulting the routing table if no source address is passed into rdma_resolve_address(). Userspace will ask for this by passing an all-zero source address in the RESOLVE_IP command. Unfortunately the new check for non-zero address size rejects this with EINVAL, which breaks valid userspace applications.

Quoted 5 lines

Fix this by explicitly allowing a zero address family for the source.

Fixes 2975d5de6428 ("RDMA/ucma: Check AF family prior resolving address")

Thanks, applied to for-rc.

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