From patchwork Wed Nov 19 14:46:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wan, Kaike" X-Patchwork-Id: 5337911 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4DE40C11AD for ; Wed, 19 Nov 2014 14:47:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 872C520122 for ; Wed, 19 Nov 2014 14:47:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA0562018E for ; Wed, 19 Nov 2014 14:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755392AbaKSOrX (ORCPT ); Wed, 19 Nov 2014 09:47:23 -0500 Received: from mga09.intel.com ([134.134.136.24]:40336 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752950AbaKSOrW (ORCPT ); Wed, 19 Nov 2014 09:47:22 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 19 Nov 2014 06:45:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,417,1413270000"; d="scan'208";a="610466696" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by orsmga001.jf.intel.com with ESMTP; 19 Nov 2014 06:47:15 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id sAJElFIS006824; Wed, 19 Nov 2014 09:47:15 -0500 Received: (from kaikewan@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id sAJElEPR006821; Wed, 19 Nov 2014 09:47:14 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: kaikewan set sender to kaike.wan@intel.com using -f From: kaike.wan@intel.com To: sean.hefty@intel.com Cc: linux-rdma@vger.kernel.org, Kaike Wan Subject: [PATCH 2/3] ibacm: close the provider endpoint when it fails to assign a name to a core endpoint Date: Wed, 19 Nov 2014 09:46:46 -0500 Message-Id: <1416408407-6774-3-git-send-email-kaike.wan@intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1416408407-6774-1-git-send-email-kaike.wan@intel.com> References: <1416408407-6774-1-git-send-email-kaike.wan@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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: Kaike Wan In function acm_ep_up(), when it fails to assign any name to an endpoint, the endpoint in the provider is not properly closed before the core endpoint is freed. This may cause segfault when ibacmp tries to join multicast group with a stale core endpoint pointer. Signed-off-by: Kaike Wan --- src/acm.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/acm.c b/src/acm.c index 11fda4c..d807c73 100644 --- a/src/acm.c +++ b/src/acm.c @@ -1744,12 +1744,15 @@ static void acm_ep_up(struct acmc_port *port, uint16_t pkey) ret = acm_assign_ep_names(ep); if (ret) { acm_log(0, "ERROR - unable to assign EP name for pkey 0x%x\n", pkey); - goto err; + goto ep_close; } DListInsertHead(&ep->entry, &port->ep_list); return; +ep_close: + port->prov->close_endpoint(ep->prov_ep_context); + err: free(ep); }