From patchwork Tue Jun 11 18:13:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2705381 X-Patchwork-Delegate: hal@mellanox.com 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 989BCC1459 for ; Tue, 11 Jun 2013 18:13:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C24C7203DA for ; Tue, 11 Jun 2013 18:13:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3825203AF for ; Tue, 11 Jun 2013 18:13:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755600Ab3FKSNl (ORCPT ); Tue, 11 Jun 2013 14:13:41 -0400 Received: from mail-ea0-f177.google.com ([209.85.215.177]:60732 "EHLO mail-ea0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755254Ab3FKSNk (ORCPT ); Tue, 11 Jun 2013 14:13:40 -0400 Received: by mail-ea0-f177.google.com with SMTP id j14so6447821eak.22 for ; Tue, 11 Jun 2013 11:13:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=F9zvV9JggmzVmcg8Z/5yNjEPfEVlVd91Ia3HUdKZr98=; b=EOakgKO2u7YvdGyv++ZsiJZfhlfgPQrJzuq5lBcVa6/GpPrkCa2Bd0xo6Lhe/F4XDG CpdP150SbwFDi6bLPwJH6XqXizsNtqtmZL49Te7KA0bw6HbBJ7EdpL4JXlRMTfrjsi2W GgLL0F87NXu5o2tyUrDN+MfFYzwnaVXOzq10GEVOkjZIwMLIf3TOv1j9DfLuqAGcXIBf l1SxB37C8rvdL53WJbAsH2Q7n2JFXwTAH/sWg29yInvRL3cghJ2qV8Db8RbLsNZ0gh/Y A/QxNsSUZlebJ6pgSEE4gj4kIJZGbnoXoixqJRH+OHKMf/3+dg11P2J8c3G49DRC3vHg MM1Q== X-Received: by 10.14.212.66 with SMTP id x42mr17840264eeo.81.1370974419318; Tue, 11 Jun 2013 11:13:39 -0700 (PDT) Received: from [192.168.1.102] (c-71-234-225-85.hsd1.ct.comcast.net. [71.234.225.85]) by mx.google.com with ESMTPSA id 3sm31967263een.7.2013.06.11.11.13.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 11:13:38 -0700 (PDT) Message-ID: <51B768D1.90503@dev.mellanox.co.il> Date: Tue, 11 Jun 2013 14:13:37 -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: Dan Ben-Yosef Subject: [PATCH 2/6] opensm: fix possible double free in osm_ucast_ftree.c X-Gm-Message-State: ALoCoQkNG4ZAAc3jLwpZ3idK2++7aU911xgM88CMFuCyLntC6iQsYOYbZjEPweQQxK1601YVf7Vk Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 49f1a71299e4aa28a8319334c772525f67cbd1ca Mon Sep 17 00:00:00 2001 From: Dan Ben Yosef Date: Thu, 16 Aug 2012 16:33:55 +0300 Subject: [PATCH 2/6] opensm: fix possible double free in osm_ucast_ftree.c Only if cl_ptr_vector_at return "CL_SUCCESS" ,the pointer "p_port" needed to be freed Signed-off-by: Dan Ben Yosef Signed-off-by: Alex Netes --- opensm/osm_ucast_ftree.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opensm/osm_ucast_ftree.c b/opensm/osm_ucast_ftree.c index fecc902..dfcd418 100644 --- a/opensm/osm_ucast_ftree.c +++ b/opensm/osm_ucast_ftree.c @@ -453,10 +453,10 @@ static void port_group_destroy(IN ftree_port_group_t * p_group) /* remove all the elements of p_group->ports vector */ size = cl_ptr_vector_get_size(&p_group->ports); - for (i = 0; i < size; i++) { - cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port); - port_destroy(p_port); - } + for (i = 0; i < size; i++) + if (cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port) == CL_SUCCESS) + port_destroy(p_port); + cl_ptr_vector_destroy(&p_group->ports); free(p_group); } /* port_group_destroy() */