From patchwork Wed Jun 3 15:56:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 6539501 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1DDFA9F1CC for ; Wed, 3 Jun 2015 15:56:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1DE9A20643 for ; Wed, 3 Jun 2015 15:56:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A76B720625 for ; Wed, 3 Jun 2015 15:56:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755091AbbFCP4f (ORCPT ); Wed, 3 Jun 2015 11:56:35 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:34957 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755229AbbFCP4f (ORCPT ); Wed, 3 Jun 2015 11:56:35 -0400 Received: by wiga1 with SMTP id a1so19510735wig.0 for ; Wed, 03 Jun 2015 08:56:34 -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=/KtmjwWtZBZc85TtagqPqB12ew6Xkoi3LPOieIB65Oc=; b=chPdShQ66uwoA2XVd+zzNOWqqvv0aKuHWZSfnUgdr0N0MTt0uK20+euHyzGJ3WbfLw mLZaDeiiCUeeylXqwP3iNf9s5k+HmSWFIAZtAhGqIoOn9veHBsBfDjhWLtWgcTkD7Fdo r4sQxk11Lc+dbXFU3UTopVCkQ3HXcep6dkI8ZY2fpIaRQ9AcnGF5tedTTpoTqfXVBb9Y MSQeMqmuyBtJb/4WSPZN+Z5J6oyqN32JSdy3tPrVpIU75EWS5ZcXzhAU6+obcX3SqxKA WSS4O9HsfJ6NXTSOgQVE+0BigsclFEnWXcrJVvnySU2fWRyqXlL4s1Uor86owWkHFkeX x7mw== X-Gm-Message-State: ALoCoQkkaEfJ6uJ5hTRWdUtUbWHTFRXi8e+cM1GR1iAaQyRc0ozpSoVvqpv2vIM4de0LryGp0c82 X-Received: by 10.180.82.135 with SMTP id i7mr44074565wiy.68.1433346993906; Wed, 03 Jun 2015 08:56:33 -0700 (PDT) Received: from [192.168.1.102] (c-71-234-225-223.hsd1.ct.comcast.net. [71.234.225.223]) by mx.google.com with ESMTPSA id c3sm1679732wja.3.2015.06.03.08.56.32 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Jun 2015 08:56:33 -0700 (PDT) Message-ID: <556F23AE.9000608@dev.mellanox.co.il> Date: Wed, 03 Jun 2015 11:56:30 -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: Daniel Klein Subject: [PATCH opensm] osm_opensm.c: Fix race condition between traps handling and SA shutdown 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=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: Daniel Klein Date: Mon, 11 May 2015 10:36:46 +0300 Bug description: When OpenSM handles traps during SA shutdown, it might append these traps to p_subn->rcvd_traps_list after the list is flushed. As a result, the memory allocated for the list elements is not released. With this change, during shutdown process OpenSM shuts down SM before shutting down the SA, in order to avoid processing traps during SA shutdown. Signed-off-by: Daniel Klein Signed-off-by: Hal Rosenstock --- opensm/osm_opensm.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opensm/osm_opensm.c b/opensm/osm_opensm.c index a64a419..1d60e34 100644 --- a/opensm/osm_opensm.c +++ b/opensm/osm_opensm.c @@ -113,17 +113,17 @@ void osm_opensm_destroy(IN osm_opensm_t * p_osm) osm_congestion_control_shutdown(&p_osm->cc); - /* shut down the SA - * - unbind from QP1 messages - */ - osm_sa_shutdown(&p_osm->sa); - /* shut down the SM * - make sure the SM sweeper thread exited * - unbind from QP0 messages */ osm_sm_shutdown(&p_osm->sm); + /* shut down the SA + * - unbind from QP1 messages + */ + osm_sa_shutdown(&p_osm->sa); + /* cleanup all messages on VL15 fifo that were not sent yet */ osm_vl15_shutdown(&p_osm->vl15, &p_osm->mad_pool);