@@ -1353,14 +1353,18 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
CMA_CREATE_MSG_CMD(msg, cmd, UCMA_CMD_CONNECT, size);
cmd->id = id_priv->handle;
- if (id->qp)
+ if (id->qp) {
ucma_copy_conn_param_to_kern(id_priv, &cmd->conn_param,
conn_param, id->qp->qp_num,
(id->qp->srq != NULL));
- else
+ } else if (conn_param) {
ucma_copy_conn_param_to_kern(id_priv, &cmd->conn_param,
conn_param, conn_param->qp_num,
conn_param->srq);
+ } else {
+ ucma_copy_conn_param_to_kern(id_priv, &cmd->conn_param,
+ conn_param, 0, 0);
+ }
ret = write(id->channel->fd, msg, size);
if (ret != size)
When using rdma_connect for UD QP lookup, there may not be any QP associated with the rdma_cm_id. Plus there may not be any use for the conn_param parameter. Allow conn_param to be optional in this situation. This fixes a crash exposed by rdma_xclient sample using XRC QPs. Signed-off-by: Sean Hefty <sean.hefty@intel.com> --- src/cma.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html