From patchwork Tue Jul 31 16:04:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Netes X-Patchwork-Id: 1261031 X-Patchwork-Delegate: alexne@voltaire.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 EAC5DDF26F for ; Tue, 31 Jul 2012 16:09:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755480Ab2GaQJg (ORCPT ); Tue, 31 Jul 2012 12:09:36 -0400 Received: from mail-vb0-f46.google.com ([209.85.212.46]:54893 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755168Ab2GaQJf (ORCPT ); Tue, 31 Jul 2012 12:09:35 -0400 Received: by mail-vb0-f46.google.com with SMTP id ff1so5920363vbb.19 for ; Tue, 31 Jul 2012 09:09:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=JJZ6cHUJZYObAzZvs7PBhGJqSjXqQVO3C1UtJCh336c=; b=cE+hEnI4YwBRW64j+I1tIVjmYnJIC7TUwoYPTCkKZzH0MMcFXxVG9ZxFKnLCBo3Qk4 z+Sn5+Mqz6xlIad8VN02zZSt7azwyN2vA7Y42aceNPg53/TyPQE6vNcXW9W9FTgTlkhv qFt1o8cckPi6MRJSvDrsRH6lXwcuNR1rjhDc4I8aR2K9j0QeTvKJJi8wAWwPbrNqCrRh zBsG2sdS53lHrLHmnjjxbCyrVvTpkt2ZyppZsBPziwgyfabvDgH1oKRx16eyxPW9VJx7 PWyHwQLO81tv9i1M+02t9bGesCTBA8pik3CSVHB61otN3lbFHHFDpcQnKP9jgEOo04sG +g+g== Received: by 10.58.68.4 with SMTP id r4mr2994948vet.21.1343750975397; Tue, 31 Jul 2012 09:09:35 -0700 (PDT) Received: from localhost ([193.47.165.251]) by mx.google.com with ESMTPS id l9sm424382vdw.14.2012.07.31.09.09.34 (version=SSLv3 cipher=OTHER); Tue, 31 Jul 2012 09:09:34 -0700 (PDT) From: Alex Netes To: linux-rdma@vger.kernel.org Cc: Hal Rosenstock , Alex Netes Subject: [PATCH 24/27] opensm/osm_node_info_rcv.c: Handle non-compliant SMA gracefully Date: Tue, 31 Jul 2012 19:04:52 +0300 Message-Id: <1343750695-28063-24-git-send-email-alexne@mellanox.com> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1343750695-28063-1-git-send-email-alexne@mellanox.com> References: <1343750695-28063-1-git-send-email-alexne@mellanox.com> X-Gm-Message-State: ALoCoQl7e5+HymyCUzCRszpMx+pwTvjjw7TlzerudDLWi/tzW6mV11Bs42dPi/VDTg6rlqRAxfTZ Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Hal Rosenstock If NodeInfo.LocalPortNum > NodeInfo.NumPorts, then SMA is not compliant. In this case, ignore the node and don't add it to any subnet data structures. Signed-off-by: Hal Rosenstock Signed-off-by: Alex Netes --- opensm/osm_node_info_rcv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/opensm/osm_node_info_rcv.c b/opensm/osm_node_info_rcv.c index c35aea4..75ab853 100644 --- a/opensm/osm_node_info_rcv.c +++ b/opensm/osm_node_info_rcv.c @@ -624,6 +624,17 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) ib_get_node_type_str(p_ni->node_type), cl_ntoh64(p_ni->node_guid), cl_ntoh64(p_smp->trans_id)); + if (port_num > p_ni->num_ports) { + OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0A: " + "New %s node GUID 0x%" PRIx64 "is non-compliant and " + "is being ignored since the " + "local port num %u > num ports %u\n", + ib_get_node_type_str(p_ni->node_type), + cl_ntoh64(p_ni->node_guid), port_num, + p_ni->num_ports); + goto Exit; + } + p_node = osm_node_new(p_madw); if (p_node == NULL) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D07: "