From patchwork Mon Oct 16 14:24:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael J. Ruhl" X-Patchwork-Id: 10008463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 824CA60235 for ; Mon, 16 Oct 2017 14:24:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7306C285C8 for ; Mon, 16 Oct 2017 14:24:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67E94285CE; Mon, 16 Oct 2017 14:24:46 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 C1FF0285C8 for ; Mon, 16 Oct 2017 14:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753070AbdJPOYn (ORCPT ); Mon, 16 Oct 2017 10:24:43 -0400 Received: from mga07.intel.com ([134.134.136.100]:51721 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752867AbdJPOYm (ORCPT ); Mon, 16 Oct 2017 10:24:42 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 16 Oct 2017 07:24:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,387,1503385200"; d="scan'208";a="1025680176" Received: from sedona.ch.intel.com ([143.182.228.65]) by orsmga003.jf.intel.com with ESMTP; 16 Oct 2017 07:24:40 -0700 Received: from phlsvsles11.ph.intel.com (phlsvsles11.ph.intel.com [10.228.195.43]) by sedona.ch.intel.com (8.13.6/8.14.3/Standard MailSET/Hub) with ESMTP id v9GEOfMw010355; Mon, 16 Oct 2017 07:24:41 -0700 Received: from phlsvslse11.ph.intel.com (localhost [127.0.0.1]) by phlsvsles11.ph.intel.com with ESMTP id v9GEOePG012964; Mon, 16 Oct 2017 10:24:40 -0400 Subject: [PATCH v2 2/2] ibacm: Incorrect list used for subnet list causes a segfault To: sean.hefty@intel.com From: "Michael J. Ruhl" Cc: linux-rdma@vger.kernel.org, hal@dev.mellanox.co.il Date: Mon, 16 Oct 2017 10:24:40 -0400 Message-ID: <20171016142426.12814.13095.stgit@phlsvslse11.ph.intel.com> In-Reply-To: <20171016142303.12814.97296.stgit@phlsvslse11.ph.intel.com> References: <20171016142303.12814.97296.stgit@phlsvslse11.ph.intel.com> User-Agent: StGit/0.16 MIME-Version: 1.0 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: Michael J. Ruhl Setting the provider keyword in the ibacm_opts.cfg file to something other than 'default' will cause ibacm to segfault on startup: ibacm[32739]: segfault at 302e40 ip 000000000040432d sp 00007ffe4039e1c0 error 4 in ibacm[400000+c000] To re-produce the segfault, change the provider keyword in ibacm_opts.cfg from: provider ibacmp default to: provider ibacmp 0xFE80000000000000 When adding subnets to a provider subnet list, the incorrect list is used. The list used is the provider_list (list of all providers) rather than the (specific) provider subnet list. This corrupts the provider_list, and causes ibacm to crash with the above segfault. Use the correct list when adding subnet information to a provider. Fixes: 26e05f8304a506 ("ibacm: use ccan/list.h") Reviewed-by: Mike Marciniszyn Signed-off-by: Michael J. Ruhl Tested-by: Nicolas Morey-Chaisemartin --- v1 -> v2 * Remove reference to library commit. --- ibacm/src/acm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c index 1ccef94..a67001d 100644 --- a/ibacm/src/acm.c +++ b/ibacm/src/acm.c @@ -2587,8 +2587,8 @@ static void acm_load_prov_config(void) return; } subnet->subnet_prefix = htobe64(prefix); - list_add_after(&provider_list, &prov->entry, - &subnet->entry); + list_add_tail(&prov->subnet_list, + &subnet->entry); } } }