Skip to content

Commit

Permalink
prov/socket: segfaults in sock_ep_connect() when it tries to derefere…
Browse files Browse the repository at this point in the history
…nce dest_addr

ofiwg#2676

The validation of destination address on NULL pointer has been added in
sock_ep_connect. The destination address is NULL in case of if no destination
address is passed as a fi_info and no connect is established. but fi_send is
called.

Change-Id: I0e526b286360756ed4dd5732b36f29ca08ed18d4
Signed-off-by: Dmitry Gladkov <dmitry.gladkov@intel.com>
  • Loading branch information
dmitrygx authored and Sayantan Sur committed Feb 15, 2017
1 parent 33acdd1 commit 6505387
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion prov/sockets/src/sock_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ struct sock_conn *sock_ep_connect(struct sock_ep_attr *ep_attr, fi_addr_t index)
struct pollfd poll_fd;

if (ep_attr->ep_type == FI_EP_MSG) {
/* Need to check that destination address has been
passed to endpoint */
assert(ep_attr->dest_addr);
addr = *ep_attr->dest_addr;
addr.sin_port = htons(ep_attr->msg_dest_port);
} else {
Expand All @@ -437,7 +440,7 @@ struct sock_conn *sock_ep_connect(struct sock_ep_attr *ep_attr, fi_addr_t index)
SOCK_LOG_ERROR("failed to set conn_fd nonblocking, errno: %d\n", errno);
errno = FI_EOTHER;
ofi_close_socket(conn_fd);
return NULL;
return NULL;
}

SOCK_LOG_DBG("Connecting to: %s:%d\n", inet_ntoa(addr.sin_addr),
Expand Down

0 comments on commit 6505387

Please sign in to comment.