From patchwork Wed Jun 15 17:42:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hefty, Sean" X-Patchwork-Id: 883002 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5FHg4Sh026286 for ; Wed, 15 Jun 2011 17:42:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752618Ab1FORmD (ORCPT ); Wed, 15 Jun 2011 13:42:03 -0400 Received: from mga01.intel.com ([192.55.52.88]:49222 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752088Ab1FORmD convert rfc822-to-8bit (ORCPT ); Wed, 15 Jun 2011 13:42:03 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 15 Jun 2011 10:42:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.65,370,1304319600"; d="scan'208";a="18588275" Received: from orsmsx602.amr.corp.intel.com ([10.22.226.211]) by fmsmga001.fm.intel.com with ESMTP; 15 Jun 2011 10:42:03 -0700 Received: from orsmsx152.amr.corp.intel.com (10.22.226.39) by orsmsx602.amr.corp.intel.com (10.22.226.211) with Microsoft SMTP Server (TLS) id 8.2.255.0; Wed, 15 Jun 2011 10:42:02 -0700 Received: from orsmsx101.amr.corp.intel.com ([169.254.8.26]) by ORSMSX152.amr.corp.intel.com ([169.254.6.32]) with mapi id 14.01.0289.001; Wed, 15 Jun 2011 10:42:01 -0700 From: "Hefty, Sean" To: "linux-rdma (linux-rdma@vger.kernel.org)" Subject: [PATCH 4/8] librdmacm: Fix crash in rdma_connect Thread-Topic: [PATCH 4/8] librdmacm: Fix crash in rdma_connect Thread-Index: Acwrg3Jl8mz4kJurRrKtKosR+yiz3Q== Date: Wed, 15 Jun 2011 17:42:01 +0000 Message-ID: <1828884A29C6694DAF28B7E6B8A823730212EF@ORSMSX101.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.9.131.214] MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 15 Jun 2011 17:42:22 +0000 (UTC) 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 --- 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 diff --git a/src/cma.c b/src/cma.c index e5ea7db..e068125 100755 --- a/src/cma.c +++ b/src/cma.c @@ -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)