public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/9] ib/addr: verify source and destination address families match
@ 2009-11-17  0:00 Sean Hefty
       [not found] ` <4329E49DC571489C9F9498770613E42D-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Hefty @ 2009-11-17  0:00 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

rdma_resolve_ip is never called with a NULL src_addr, so we just need
to verify that the source and destination address families match.

Signed-of-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

 drivers/infiniband/core/addr.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index ccc0f91..f5baf0b 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -461,8 +461,10 @@ int rdma_resolve_ip(struct rdma_addr_client *client,
 	if (!req)
 		return -ENOMEM;
 
-	if (src_addr)
-		memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr));
+	if (src_addr->sa_family != dst_addr->sa_family)
+		return -EINVAL;
+
+	memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr));
 	memcpy(&req->dst_addr, dst_addr, ip_addr_size(dst_addr));
 	req->addr = addr;
 	req->callback = callback;



--
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] 6+ messages in thread

end of thread, other threads:[~2009-11-19 16:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-17  0:00 [PATCH 5/9] ib/addr: verify source and destination address families match Sean Hefty
     [not found] ` <4329E49DC571489C9F9498770613E42D-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2009-11-18 16:50   ` [PATCH 5/9 v2] " Sean Hefty
     [not found]     ` <75A0BA738B5E4574AC17BB674109FBB2-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2009-11-19  0:59       ` Roland Dreier
     [not found]         ` <adaws1n8h3e.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2009-11-19  1:27           ` Sean Hefty
     [not found]             ` <7F0D72D35EF140058670BF8E228966B8-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2009-11-19  1:30               ` Roland Dreier
2009-11-19 16:42       ` [PATCH 5/9 v3] " Sean Hefty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox