From patchwork Mon Apr 8 11:36:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2408021 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 38521DFB78 for ; Mon, 8 Apr 2013 11:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935064Ab3DHLgo (ORCPT ); Mon, 8 Apr 2013 07:36:44 -0400 Received: from mail-ee0-f49.google.com ([74.125.83.49]:34194 "EHLO mail-ee0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934522Ab3DHLgo (ORCPT ); Mon, 8 Apr 2013 07:36:44 -0400 Received: by mail-ee0-f49.google.com with SMTP id l10so1058003eei.22 for ; Mon, 08 Apr 2013 04:36:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=Ieajr0hqSVWEJ+f2564mMhYI0VGvuogIDkh2GLMeANY=; b=SJceY98wMXqSd1+zUw9WGjyHNOPEwAPx5yohdRzID6jFZ0Ps4mNaeN5/LEAzXQrnVI OUcG4Mkr20E9/6Y+/ifAwRJQATC46zouWvrv0KvrslBssdET2l7B7r0MUIMLR9hQdsfo gEmbjnexaOhRcIiXi7cLwGZrvDpbipH+p6HBDqJmi7EnEEs9mdEVripDWHrSPXBisTFK 21NCNdya30Lg4i94QYp5ZGewvwtSVtN1MwMgLIC2yKGXfS5Put0gjllL5ZwLmRe9vxOM +LDBJKtfrm94F+sQifcg2szSxFcRAeR0PsA8/2eZk4Zq9nApLzrRqZEimlob2Hxqurev AEoA== X-Received: by 10.14.216.2 with SMTP id f2mr48083013eep.44.1365421002860; Mon, 08 Apr 2013 04:36:42 -0700 (PDT) Received: from [192.168.1.102] (c-71-234-225-85.hsd1.ct.comcast.net. [71.234.225.85]) by mx.google.com with ESMTPS id cb50sm9782173eeb.14.2013.04.08.04.36.41 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Apr 2013 04:36:42 -0700 (PDT) Message-ID: <5162ABC9.8040606@dev.mellanox.co.il> Date: Mon, 08 Apr 2013 07:36:41 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" Subject: [PATCH opensm] osm_sa_mcmember_record.c: On join and leave, validate subnet prefix in port GID X-Gm-Message-State: ALoCoQmfBffT70rDs4HnwLrvN6wZMAQylMr8O/1eJLbgAV/8FuXiSrFp+2UVmXXsAHjNcLKubocr Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Signed-off-by: Hal Rosenstock --- -- 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/opensm/osm_sa_mcmember_record.c b/opensm/osm_sa_mcmember_record.c index 4a9ad71..242fcde 100644 --- a/opensm/osm_sa_mcmember_record.c +++ b/opensm/osm_sa_mcmember_record.c @@ -911,6 +919,18 @@ static void mcmr_rcv_leave_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw) mcmember_rec = *p_recvd_mcmember_rec; + /* Validate the subnet prefix in the PortGID */ + if (p_recvd_mcmember_rec->port_gid.unicast.prefix != + sa->p_subn->opt.subnet_prefix) { + OSM_LOG(sa->p_log, OSM_LOG_DEBUG, + "PortGID subnet prefix 0x%" PRIx64 + " does not match configured prefix 0x%" PRIx64 "\n", + cl_ntoh64(p_recvd_mcmember_rec->port_gid.unicast.prefix), + cl_ntoh64(sa->p_subn->opt.subnet_prefix)); + osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_INVALID_GID); + goto Exit; + } + if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) { osm_physp_t *p_req_physp; @@ -998,6 +1018,18 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw) mcmember_rec = *p_recvd_mcmember_rec; + /* Validate the subnet prefix in the PortGID */ + if (p_recvd_mcmember_rec->port_gid.unicast.prefix != + sa->p_subn->opt.subnet_prefix) { + OSM_LOG(sa->p_log, OSM_LOG_DEBUG, + "PortGID subnet prefix 0x%" PRIx64 + " does not match configured prefix 0x%" PRIx64 "\n", + cl_ntoh64(p_recvd_mcmember_rec->port_gid.unicast.prefix), + cl_ntoh64(sa->p_subn->opt.subnet_prefix)); + osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_INVALID_GID); + goto Exit; + } + if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) { osm_physp_t *p_req_physp;