From patchwork Mon Mar 16 17:09:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 6023021 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7B66DBF90F for ; Mon, 16 Mar 2015 17:09:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F916203E9 for ; Mon, 16 Mar 2015 17:09:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 44EC1200E7 for ; Mon, 16 Mar 2015 17:09:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933171AbbCPRJh (ORCPT ); Mon, 16 Mar 2015 13:09:37 -0400 Received: from mail-wg0-f47.google.com ([74.125.82.47]:36069 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933140AbbCPRJg (ORCPT ); Mon, 16 Mar 2015 13:09:36 -0400 Received: by wgra20 with SMTP id a20so45384701wgr.3 for ; Mon, 16 Mar 2015 10:09:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=Il0sGBsYOpWzpyCBJ1NKPQegS5wKF7VpjHQ1C05bS8M=; b=Mt6e5K58MsbMoQ0rZnAPSAQdSMp7p3FYsb4B7xUy29UL1Du7g4IPsHYuniPvBMUCDG d7+I7kNUfewtmp4xnoWbWvxkvlbc2sx/ZTWB1ORszIoAru/5zkKKahl57QsQU1+/wout p5pItjq/5z9leYCG4bUZftIfXcV1f95CBUdabPCDcCKdgo+Hrg5WlVGFL8XNj3mjm1Bd c3W5yXviJjwiBiDvck5T/49qMzoHiaooP9tpmW3yfDKfC4BWVecERC5DpExijYVAsB0k YtbEoO7MZIianwqJ5mUSN5MH04qcEkiyRb+m5slix0mAoEtHYHndr0VgCSugMwUdpb55 JZjQ== X-Gm-Message-State: ALoCoQkpudltq2RurP5cwp1iQBmim0RVcZBdIJ7+1Hj+ZDnR1bXFhFjC/nFB/O+HkANbfOCgeNW3 X-Received: by 10.180.109.70 with SMTP id hq6mr83347274wib.16.1426525774486; Mon, 16 Mar 2015 10:09:34 -0700 (PDT) Received: from [192.168.1.102] (c-98-229-118-119.hsd1.ma.comcast.net. [98.229.118.119]) by mx.google.com with ESMTPSA id gj16sm16153631wic.24.2015.03.16.10.09.31 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Mar 2015 10:09:32 -0700 (PDT) Message-ID: <55070E3F.2030005@dev.mellanox.co.il> Date: Mon, 16 Mar 2015 13:09:19 -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)" CC: Daniel Klein Subject: [PATCH opensm] osm_sa_mcmember_record.c: Extend P_Pkey validation on MCMemberRecord(Join) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Klein Verify that a port that joins a multicast group is in the partition for that MC group. Signed-off-by: Daniel Klein Signed-off-by: Hal Rosenstock --- opensm/osm_sa_mcmember_record.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/opensm/osm_sa_mcmember_record.c b/opensm/osm_sa_mcmember_record.c index 227742a..8d7938d 100644 --- a/opensm/osm_sa_mcmember_record.c +++ b/opensm/osm_sa_mcmember_record.c @@ -1197,6 +1197,24 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw) goto Exit; } + /* verify that the joining port is in the partition of the group */ + if (!osm_physp_has_pkey(sa->p_log, p_mgrp->mcmember_rec.pkey, p_physp)) { + char gid_str[INET6_ADDRSTRLEN]; + if (is_new_group) + osm_mgrp_cleanup(sa->p_subn, p_mgrp); + CL_PLOCK_RELEASE(sa->p_lock); + memset(gid_str, 0, sizeof(gid_str)); + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B14: " + "Cannot join port 0x%016" PRIx64 " to MGID %s - " + "Port is not in partition of this MC group\n", + cl_ntoh64(portguid), + inet_ntop(AF_INET6, + p_mgrp->mcmember_rec.mgid.raw, + gid_str, sizeof(gid_str))); + osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID); + goto Exit; + } + /* * o15-0.2.1 requires validation of the requesting port * in the case of modification: