From patchwork Fri Oct 30 14:49:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 56616 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 n9UDnl3r003162 for ; Fri, 30 Oct 2009 13:49:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757236AbZJ3Ntl (ORCPT ); Fri, 30 Oct 2009 09:49:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757230AbZJ3Ntl (ORCPT ); Fri, 30 Oct 2009 09:49:41 -0400 Received: from qmta09.westchester.pa.mail.comcast.net ([76.96.62.96]:51232 "EHLO QMTA09.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757236AbZJ3Ntj (ORCPT ); Fri, 30 Oct 2009 09:49:39 -0400 Received: from OMTA03.westchester.pa.mail.comcast.net ([76.96.62.27]) by QMTA09.westchester.pa.mail.comcast.net with comcast id yynp1c0040bG4ec591plRu; Fri, 30 Oct 2009 13:49:45 +0000 Received: from hal.comcast.net ([75.69.247.31]) by OMTA03.westchester.pa.mail.comcast.net with comcast id z1pk1c00Z0hNrtn3P1pkkb; Fri, 30 Oct 2009 13:49:45 +0000 Received: from hal.comcast.net (localhost.localdomain [127.0.0.1]) by hal.comcast.net (8.14.3/8.14.3) with ESMTP id n9UEoaYB026919; Fri, 30 Oct 2009 09:50:40 -0500 Received: (from hnrose@localhost) by hal.comcast.net (8.14.3/8.14.3/Submit) id n9UEnJ0L026851; Fri, 30 Oct 2009 09:49:19 -0500 Date: Fri, 30 Oct 2009 09:49:19 -0500 From: Hal Rosenstock To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org Subject: [PATCH] opensm/osm_mcast_tbl.c: Fix multicast group removal Message-ID: <20091030144919.GA26847@comcast.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/opensm/opensm/osm_mcast_tbl.c b/opensm/opensm/osm_mcast_tbl.c index 0a45904..da106c6 100644 --- a/opensm/opensm/osm_mcast_tbl.c +++ b/opensm/opensm/osm_mcast_tbl.c @@ -122,7 +122,7 @@ int osm_mcast_tbl_realloc(IN osm_mcast_tbl_t * p_tbl, IN uintn_t mlid_offset) uint16_t (*p_mask_tbl)[][IB_MCAST_POSITION_MAX]; if (mlid_offset < p_tbl->mft_depth) - goto done; + return 0; /* The number of bytes needed in the mask table is: @@ -144,7 +144,6 @@ int osm_mcast_tbl_realloc(IN osm_mcast_tbl_t * p_tbl, IN uintn_t mlid_offset) size - p_tbl->mft_depth * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8); p_tbl->p_mask_tbl = p_mask_tbl; p_tbl->mft_depth = mft_depth; -done: p_tbl->max_mlid_ho = mlid_offset + IB_LID_MCAST_START_HO; return 0; } @@ -167,6 +166,9 @@ boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl, CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho); mlid_offset = mlid_ho - IB_LID_MCAST_START_HO; + if (mlid_offset >= p_tbl->mft_depth) + return FALSE; + mask_offset = port_num / IB_MCAST_MASK_SIZE; bit_mask = cl_ntoh16((uint16_t) (1 << (port_num % IB_MCAST_MASK_SIZE))); @@ -194,6 +196,8 @@ boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl, CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho); mlid_offset = mlid_ho - IB_LID_MCAST_START_HO; + if (mlid_offset >= p_tbl->mft_depth) + return FALSE; for (position = 0; position <= p_tbl->max_position; position++) result |= (*p_tbl->p_mask_tbl)[mlid_offset][position]; @@ -247,6 +251,8 @@ void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho) if (p_tbl->p_mask_tbl && mlid_ho <= p_tbl->max_mlid_ho) { mlid_offset = mlid_ho - IB_LID_MCAST_START_HO; + if (mlid_offset >= p_tbl->mft_depth) + return; for (i = 0; i <= p_tbl->max_position; i++) (*p_tbl->p_mask_tbl)[mlid_offset][i] = 0; }