From patchwork Tue Nov 17 00:00:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hefty, Sean" X-Patchwork-Id: 60546 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAH00LqK015265 for ; Tue, 17 Nov 2009 00:00:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753539AbZKQAAO (ORCPT ); Mon, 16 Nov 2009 19:00:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754462AbZKQAAO (ORCPT ); Mon, 16 Nov 2009 19:00:14 -0500 Received: from mga02.intel.com ([134.134.136.20]:8787 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754347AbZKQAAN (ORCPT ); Mon, 16 Nov 2009 19:00:13 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 16 Nov 2009 15:45:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.44,754,1249282800"; d="scan'208";a="467872192" Received: from mshefty-mobl2.amr.corp.intel.com (HELO msheftyMOBL2) ([10.24.90.109]) by orsmga002.jf.intel.com with ESMTP; 16 Nov 2009 16:17:26 -0800 From: "Sean Hefty" To: Subject: [PATCH 5/9] ib/addr: verify source and destination address families match Date: Mon, 16 Nov 2009 16:00:19 -0800 Message-ID: <4329E49DC571489C9F9498770613E42D@amr.corp.intel.com> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcpnGPNQqFVf+RZQRByQrHI8lNxRcw== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index ccc0f91..f5baf0b 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -461,8 +461,10 @@ int rdma_resolve_ip(struct rdma_addr_client *client, if (!req) return -ENOMEM; - if (src_addr) - memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr)); + if (src_addr->sa_family != dst_addr->sa_family) + return -EINVAL; + + memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr)); memcpy(&req->dst_addr, dst_addr, ip_addr_size(dst_addr)); req->addr = addr; req->callback = callback;