]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
librdmacm: Validate source address protocol family in rdma_resolve_addr
authorYann Droneaud <ydroneaud@opteya.com>
Wed, 11 Jul 2012 18:54:39 +0000 (11:54 -0700)
committerSean Hefty <sean.hefty@intel.com>
Wed, 11 Jul 2012 18:54:39 +0000 (11:54 -0700)
If a source address is provided but its protocol family is not recognized,
returns an error.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/cma.c

index f688c4c24b098a05c31bc1953959b6b076856ffb..86dd7876149c9c45bb3985de2b33a87ac15a170a 100755 (executable)
--- 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);