From patchwork Mon Jun 2 10:17:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 4281051 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3DDEE9F387 for ; Mon, 2 Jun 2014 10:17:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61A512021B for ; Mon, 2 Jun 2014 10:17:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13211201EF for ; Mon, 2 Jun 2014 10:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753128AbaFBKRx (ORCPT ); Mon, 2 Jun 2014 06:17:53 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:62864 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752959AbaFBKRw (ORCPT ); Mon, 2 Jun 2014 06:17:52 -0400 Received: by mail-wi0-f181.google.com with SMTP id n15so4328952wiw.8 for ; Mon, 02 Jun 2014 03:17:50 -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=tD710/oV9wNtEn2QS8NNGvBdGtP08gdYaSyfbFFo8Vw=; b=jAh11zZIpjFCj46QZjbQsILLq45F61rRhmHCHqBR7RAW1x/Ljdn+zauJevYlu3GqXI mUmDYRBUxd3ycMIfb8Jb168zke6MzWYTbreTHN+skFd1KM0ZYSipIfMfAkcX5kmDVsow 34O62Du13biRbbtmtdzJZ7Evtn7mqKZS/xJWKdtGpvTQtpcd0t8C6UhJdG+WTFDvn+Nz 6syrQ/5YX6WKoI84btV9bsWfG1ZKVsWsLkuYT370vza6WsMEwAhQLNc6csrovnQUaCCn QmHa4gNn22flikhNjP9e0JBxd6tI3TYLWn84ysZzt9xqKFyAN48kba3BhsOmgRTLVJez 3jyg== X-Gm-Message-State: ALoCoQkgVW6YkKTYT1IvkyT8ri+zLWmAPFcdiHK3ALaortCZaJOG9kkrw2ZS65rsmnF1srgsv3oE X-Received: by 10.194.62.176 with SMTP id z16mr48405427wjr.76.1401704270196; Mon, 02 Jun 2014 03:17:50 -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 c2sm34272284wja.18.2014.06.02.03.17.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 03:17:49 -0700 (PDT) Message-ID: <538C4F46.3070607@dev.mellanox.co.il> Date: Mon, 02 Jun 2014 06:17:42 -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: Vladimir Koushnir Subject: [PATCH opensm] osm_sa_guidinfo_record.c: Fix crash when receiving AGUID SET/DELETE with block_num equal to max_block Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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: Vladimir Koushnir Signed-off-by: Vladimir Koushnir Signed-off-by: Hal Rosenstock --- opensm/osm_sa_guidinfo_record.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opensm/osm_sa_guidinfo_record.c b/opensm/osm_sa_guidinfo_record.c index 1ad8cad..d96db54 100644 --- a/opensm/osm_sa_guidinfo_record.c +++ b/opensm/osm_sa_guidinfo_record.c @@ -396,7 +396,7 @@ static void del_guidinfo(IN osm_sa_t *sa, IN osm_madw_t *p_madw, max_block = (p_port->p_physp->port_info.guid_cap + GUID_TABLE_MAX_ENTRIES - 1) / GUID_TABLE_MAX_ENTRIES; - if (block_num > max_block) { + if (block_num >= max_block) { OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5116: " "block_num %d is higher than Max GUID Cap block %d " "for port GUID 0x%" PRIx64 "\n", @@ -503,7 +503,7 @@ static void set_guidinfo(IN osm_sa_t *sa, IN osm_madw_t *p_madw, max_block = (p_port->p_physp->port_info.guid_cap + GUID_TABLE_MAX_ENTRIES - 1) / GUID_TABLE_MAX_ENTRIES; - if (block_num > max_block) { + if (block_num >= max_block) { OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5118: " "block_num %d is higher than Max GUID Cap block %d " "for port GUID 0x%" PRIx64 "\n",