From patchwork Tue Jul 30 10:54:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Gorenko X-Patchwork-Id: 11065555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5FDBC912 for ; Tue, 30 Jul 2019 10:55:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BFDD285E1 for ; Tue, 30 Jul 2019 10:55:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 390F5287B6; Tue, 30 Jul 2019 10:55:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D92A1285E1 for ; Tue, 30 Jul 2019 10:55:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729040AbfG3KzO (ORCPT ); Tue, 30 Jul 2019 06:55:14 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:57348 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728940AbfG3KzO (ORCPT ); Tue, 30 Jul 2019 06:55:14 -0400 Received: from Internal Mail-Server by MTLPINE2 (envelope-from sergeygo@mellanox.com) with ESMTPS (AES256-SHA encrypted); 30 Jul 2019 13:55:09 +0300 Received: from rsws38.mtr.labs.mlnx (rsws38.mtr.labs.mlnx [10.209.40.117]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x6UAt9wo025972; Tue, 30 Jul 2019 13:55:09 +0300 From: Sergey Gorenko To: bvanassche@acm.org Cc: linux-rdma@vger.kernel.org, Vladimir Koushnir , Sergey Gorenko Subject: [PATCH rdma-core] srp_daemon: check that port LID is valid before calling create_ah Date: Tue, 30 Jul 2019 10:54:55 +0000 Message-Id: <20190730105455.15080-1-sergeygo@mellanox.com> X-Mailer: git-send-email 2.17.2 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vladimir Koushnir The default LID that is given to the port is not valid (a valid LID value is > 0 and < 0xc000), so in case the port didn't get a valid lid from the SM there is no need to call create_ah. Signed-off-by: Vladimir Koushnir Signed-off-by: Sergey Gorenko Reviewed-by: Bart Van Assche --- srp_daemon/srp_daemon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c index e85b96686d47..337b21c7d7c9 100644 --- a/srp_daemon/srp_daemon.c +++ b/srp_daemon/srp_daemon.c @@ -2228,8 +2228,9 @@ catas_start: pr_debug("Starting a recalculation\n"); port_lid = get_port_lid(res->ud_res->ib_ctx, config->port_num, &sm_lid); - if (port_lid != res->ud_res->port_attr.lid || - sm_lid != res->ud_res->port_attr.sm_lid) { + if (port_lid > 0 && port_lid < 0xc000 && + (port_lid != res->ud_res->port_attr.lid || + sm_lid != res->ud_res->port_attr.sm_lid)) { if (res->ud_res->ah) { ibv_destroy_ah(res->ud_res->ah);