From patchwork Fri Apr 29 13:27:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 741011 X-Patchwork-Delegate: alexne@voltaire.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3TDQl4U010898 for ; Fri, 29 Apr 2011 13:27:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756050Ab1D2N1o (ORCPT ); Fri, 29 Apr 2011 09:27:44 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:62837 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752114Ab1D2N1o (ORCPT ); Fri, 29 Apr 2011 09:27:44 -0400 Received: by mail-wy0-f174.google.com with SMTP id 21so2840843wya.19 for ; Fri, 29 Apr 2011 06:27:43 -0700 (PDT) Received: by 10.216.241.197 with SMTP id g47mr653516wer.24.1304083663399; Fri, 29 Apr 2011 06:27:43 -0700 (PDT) Received: from [192.168.1.100] (c-71-192-10-85.hsd1.ma.comcast.net [71.192.10.85]) by mx.google.com with ESMTPS id x1sm1708647wbh.36.2011.04.29.06.27.41 (version=SSLv3 cipher=OTHER); Fri, 29 Apr 2011 06:27:42 -0700 (PDT) Message-ID: <4DBABCCC.2080102@dev.mellanox.co.il> Date: Fri, 29 Apr 2011 09:27:40 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: Alex Netes CC: "linux-rdma@vger.kernel.org" Subject: [PATCH 7/13] opensm/osm_sa_guidinfo_record.c: In del_guidinfo, validate guid not in use 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]); Fri, 29 Apr 2011 13:27:45 +0000 (UTC) From 45754088b3c8afc785a87678577494c6169c7a4c Mon Sep 17 00:00:00 2001 From: Hal Rosenstock Date: Thu, 28 Apr 2011 23:55:35 +0300 Subject: [PATCH] opensm/osm_sa_guidinfo_record.c: In del_guidinfo, validate guid not in use When deleting an alias GUID (by index), validate that the alias GUID is not in current use (in a multicast group). If it is, issue SA denied status. Signed-off-by: Hal Rosenstock --- opensm/osm_sa_guidinfo_record.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/opensm/osm_sa_guidinfo_record.c b/opensm/osm_sa_guidinfo_record.c index c4b7d3d..daf28ac 100644 --- a/opensm/osm_sa_guidinfo_record.c +++ b/opensm/osm_sa_guidinfo_record.c @@ -402,6 +402,9 @@ static void del_guidinfo(IN osm_sa_t *sa, IN osm_madw_t *p_madw, ib_guidinfo_record_t *p_rcvd_rec; ib_net64_t del_alias_guid; osm_alias_guid_t *p_alias_guid; + cl_list_item_t *p_list_item; + osm_mcm_port_t *p_mcm_port; + osm_mcm_alias_guid_t *p_mcm_alias_guid; uint8_t del_mask; int dirty = 0; @@ -430,6 +433,30 @@ static void del_guidinfo(IN osm_sa_t *sa, IN osm_madw_t *p_madw, del_alias_guid = (*p_port->p_physp->p_guids)[i]; if (del_alias_guid) { + /* Search all of port's multicast groups for alias */ + p_list_item = cl_qlist_head(&p_port->mcm_list); + while (p_list_item != cl_qlist_end(&p_port->mcm_list)) { + p_mcm_port = cl_item_obj(p_list_item, + p_mcm_port, list_item); + p_list_item = cl_qlist_next(p_list_item); + p_mcm_alias_guid = osm_mgrp_get_mcm_alias_guid(p_mcm_port->mgrp, del_alias_guid); + if (p_mcm_alias_guid) { + osm_sa_send_error(sa, p_madw, + IB_SA_MAD_STATUS_DENIED); + return; + } + } + } + } + + for (i = block_num * GUID_TABLE_MAX_ENTRIES; + (block_num + 1) * GUID_TABLE_MAX_ENTRIES < p_port->p_physp->port_info.guid_cap ? i < (block_num + 1) * GUID_TABLE_MAX_ENTRIES : i < p_port->p_physp->port_info.guid_cap; + i++) { + if (!(del_mask & 1<<(i % 8))) + continue; + + del_alias_guid = (*p_port->p_physp->p_guids)[i]; + if (del_alias_guid) { /* remove original from alias guid table */ p_alias_guid = (osm_alias_guid_t *) cl_qmap_remove(&sa->p_subn->alias_port_guid_tbl,