From patchwork Mon Feb 4 13:20:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Netes X-Patchwork-Id: 2091951 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5A0B340106 for ; Mon, 4 Feb 2013 13:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755276Ab3BDNU0 (ORCPT ); Mon, 4 Feb 2013 08:20:26 -0500 Received: from mail-ve0-f171.google.com ([209.85.128.171]:58338 "EHLO mail-ve0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755236Ab3BDNUX (ORCPT ); Mon, 4 Feb 2013 08:20:23 -0500 Received: by mail-ve0-f171.google.com with SMTP id b10so4665993vea.2 for ; Mon, 04 Feb 2013 05:20:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=nvw+HfPwHgvedUdEfuITrPMZNEb+ICz5SyAPrcZAIZ0=; b=ArShfB0IQl0sbIDXpU29RylKgD912UpqP0ZOFoFtNSnnzSL6zxzbLkdbGjcENzd2cE mu71p/5F1caCqb7LZsomtd/DDUC5Ctk7Sq8TsRPvbjRr7AvHPV6brUyyJsvBmtxP4UTn yvBEyFgSy7eboqJ5rGFRjnFeZrInaXyQL5AAz9GsWk/Sq3oPmzC31fojNvsRFooWZ3J9 Ys5OPgZSm1Gsmfcs7TUKtUj0Ydz759jgRZF4Z70WXOuHVZ+HHSSwolL/X2/lVZ8tQBI0 zN5U0T4Jx4In2ao3WLZw073mNat6c7nwF4w1U9/IBNR9nkr3tOo/xD3LYODv/nYOBLJS O2gw== X-Received: by 10.52.88.168 with SMTP id bh8mr18955247vdb.51.1359984022745; Mon, 04 Feb 2013 05:20:22 -0800 (PST) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPS id cd16sm21649105vdb.0.2013.02.04.05.20.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 04 Feb 2013 05:20:21 -0800 (PST) From: Alex Netes To: linux-rdma@vger.kernel.org Cc: Ilya Nelkenbaum , Alex Netes Subject: [PATCH] opensm/osm_congestion_control.c: fix use-after-free found by coverity Date: Mon, 4 Feb 2013 15:20:03 +0200 Message-Id: <1359984011-30753-2-git-send-email-alexne@mellanox.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1359984011-30753-1-git-send-email-alexne@mellanox.com> References: <1359984011-30753-1-git-send-email-alexne@mellanox.com> X-Gm-Message-State: ALoCoQmSF+5DwwGpiuHc1SX54anXv2juwQ5K1PFz8HnImI+k3s/pU8aao7Ciyg9mUhkSa0+0obKb Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Ilya Nelkenbaum Read from pointer "p_madw" after free Signed-off-by: Ilya Nelkenbaum Signed-off-by: Alex Netes --- opensm/osm_congestion_control.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/opensm/osm_congestion_control.c b/opensm/osm_congestion_control.c index e103ab1..17af407 100644 --- a/opensm/osm_congestion_control.c +++ b/opensm/osm_congestion_control.c @@ -521,6 +521,7 @@ static void cc_poller_send(osm_congestion_control_t *p_cc, { osm_subn_opt_t *p_opt = &p_cc->subn->opt; ib_api_status_t status; + osm_madw_context_t mad_context = p_madw->context; status = osm_vendor_send(p_cc->bind_handle, p_madw, TRUE); if (status == IB_SUCCESS) { @@ -530,15 +531,11 @@ static void cc_poller_send(osm_congestion_control_t *p_cc, cl_event_wait_on(&p_cc->sig_mads_on_wire_continue, EVENT_NO_TIMEOUT, TRUE); - } - else { - osm_madw_context_t *mad_context = &p_madw->context; - + } else OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C104: " "send failed to node 0x%" PRIx64 "port %u\n", - mad_context->cc_context.node_guid, - mad_context->cc_context.port); - } + mad_context.cc_context.node_guid, + mad_context.cc_context.port); } static void cc_poller(void *p_ptr)