All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH librdmacm] rdma_resolve_addr: source address protocol family must be valid
@ 2012-07-11 15:18 Yann Droneaud
       [not found] ` <1342019933-15056-1-git-send-email-ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Yann Droneaud @ 2012-07-11 15:18 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Yann Droneaud

If a source address is provided but its protocol family is not recognized,
returns an error.

Signed-off-by: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
---
 src/cma.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/cma.c b/src/cma.c
index f688c4c..364b587 100755
--- a/src/cma.c
+++ b/src/cma.c
@@ -811,6 +811,9 @@ int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
 		return ERR(EINVAL);
 
 	src_len = ucma_addrlen(src_addr);
+	if (src_addr && !src_len)
+		return ERR(EINVAL);
+
 	if (af_ib_support)
 		return rdma_resolve_addr2(id, src_addr, src_len, dst_addr,
 					  dst_len, timeout_ms);
@@ -818,7 +821,7 @@ int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
 	CMA_INIT_CMD(&cmd, sizeof cmd, RESOLVE_IP);
 	id_priv = container_of(id, struct cma_id_private, id);
 	cmd.id = id_priv->handle;
-	if (src_addr)
+	if (src_len)
 		memcpy(&cmd.src_addr, src_addr, src_len);
 	memcpy(&cmd.dst_addr, dst_addr, dst_len);
 	cmd.timeout_ms = timeout_ms;
-- 
1.7.2.5

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH librdmacm] rdma_resolve_addr: source address protocol family must be valid
       [not found] ` <1342019933-15056-1-git-send-email-ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
@ 2012-07-11 18:56   ` Hefty, Sean
  0 siblings, 0 replies; 2+ messages in thread
From: Hefty, Sean @ 2012-07-11 18:56 UTC (permalink / raw)
  To: Yann Droneaud, linux-rdma-u79uwXL29TY76Z2rM5mHXA

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-11 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 15:18 [PATCH librdmacm] rdma_resolve_addr: source address protocol family must be valid Yann Droneaud
     [not found] ` <1342019933-15056-1-git-send-email-ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2012-07-11 18:56   ` Hefty, Sean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.