From patchwork Wed May 29 17:09:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hefty, Sean" X-Patchwork-Id: 2631701 X-Patchwork-Delegate: roland@digitalvampire.org Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9D05940232 for ; Wed, 29 May 2013 17:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759680Ab3E2RKA (ORCPT ); Wed, 29 May 2013 13:10:00 -0400 Received: from mga09.intel.com ([134.134.136.24]:6764 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759516Ab3E2RJu (ORCPT ); Wed, 29 May 2013 13:09:50 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 29 May 2013 10:07:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,765,1363158000"; d="scan'208";a="321424649" Received: from cst-linux.jf.intel.com ([10.23.221.72]) by orsmga001.jf.intel.com with ESMTP; 29 May 2013 10:09:39 -0700 From: sean.hefty@intel.com To: roland@purestorage.com, linux-rdma@vger.kernel.org, netdev@vger.kernel.org Cc: Sean Hefty Subject: [PATCH v5 10/28] rdma/cm: Verify that source and dest sa_family are the same Date: Wed, 29 May 2013 10:09:16 -0700 Message-Id: <1369847374-12176-11-git-send-email-sean.hefty@intel.com> X-Mailer: git-send-email 1.7.3 In-Reply-To: <1369847374-12176-1-git-send-email-sean.hefty@intel.com> References: <1369847374-12176-1-git-send-email-sean.hefty@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Sean Hefty Signed-off-by: Sean Hefty --- drivers/infiniband/core/cma.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index c6cc3a4..67aaadc 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -1849,14 +1849,9 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv) struct rdma_addr *addr = &route->addr; struct cma_work *work; int ret; - struct sockaddr_in *src_addr = (struct sockaddr_in *)&route->addr.src_addr; - struct sockaddr_in *dst_addr = (struct sockaddr_in *)&route->addr.dst_addr; struct net_device *ndev = NULL; u16 vid; - if (src_addr->sin_family != dst_addr->sin_family) - return -EINVAL; - work = kzalloc(sizeof *work, GFP_KERNEL); if (!work) return -ENOMEM; @@ -2132,6 +2127,9 @@ int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, return ret; } + if (cma_family(id_priv) != dst_addr->sa_family) + return -EINVAL; + if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY)) return -EINVAL;