From patchwork Tue Jun 9 20:46:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 28347 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id D0F72B70A1 for ; Wed, 10 Jun 2009 06:46:31 +1000 (EST) Received: by ozlabs.org (Postfix) id BA0D8DDD1B; Wed, 10 Jun 2009 06:46:31 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 5B285DDD04 for ; Wed, 10 Jun 2009 06:46:31 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755450AbZFIUqX (ORCPT ); Tue, 9 Jun 2009 16:46:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753891AbZFIUqW (ORCPT ); Tue, 9 Jun 2009 16:46:22 -0400 Received: from sj-iport-6.cisco.com ([171.71.176.117]:41529 "EHLO sj-iport-6.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751785AbZFIUqV (ORCPT ); Tue, 9 Jun 2009 16:46:21 -0400 X-IronPort-AV: E=Sophos;i="4.41,335,1241395200"; d="scan'208";a="320042654" Received: from sj-dkim-2.cisco.com ([171.71.179.186]) by sj-iport-6.cisco.com with ESMTP; 09 Jun 2009 20:46:24 +0000 Received: from sj-core-1.cisco.com (sj-core-1.cisco.com [171.71.177.237]) by sj-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id n59KkOgd008749; Tue, 9 Jun 2009 13:46:24 -0700 Received: from xbh-sjc-211.amer.cisco.com (xbh-sjc-211.cisco.com [171.70.151.144]) by sj-core-1.cisco.com (8.13.8/8.13.8) with ESMTP id n59KkOvH019692; Tue, 9 Jun 2009 20:46:24 GMT Received: from xfe-sjc-211.amer.cisco.com ([171.70.151.174]) by xbh-sjc-211.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 9 Jun 2009 13:46:24 -0700 Received: from roland-conroe ([10.33.42.9]) by xfe-sjc-211.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 9 Jun 2009 13:46:23 -0700 Received: by roland-conroe (Postfix, from userid 33217) id 87B6CE71D7; Tue, 9 Jun 2009 13:46:23 -0700 (PDT) From: Roland Dreier To: Yevgeny Petrilin Cc: netdev@vger.kernel.org, general@lists.openfabrics.org, Christoph Lameter Subject: Re: [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table References: <4A2BD9B9.6000802@mellanox.co.il> X-Message-Flag: Warning: May contain useful information Date: Tue, 09 Jun 2009 13:46:23 -0700 In-Reply-To: <4A2BD9B9.6000802@mellanox.co.il> (Yevgeny Petrilin's message of "Sun, 07 Jun 2009 18:16:09 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux) MIME-Version: 1.0 X-OriginalArrivalTime: 09 Jun 2009 20:46:23.0960 (UTC) FILETIME=[5A0C3580:01C9E943] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=1013; t=1244580384; x=1245444384; c=relaxed/simple; s=sjdkim2002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=rdreier@cisco.com; z=From:=20Roland=20Dreier=20 |Subject:=20Re=3A=20[ofa-general][PATCH]=20mlx4=3A=20FIX=20 error=20flow=20when=20initializing=20EQ=20table |Sender:=20; bh=4taQeCH+tWG+91fk2f8S6Wk+GrFbb4MFYPyYCwO+RQs=; b=Y2DIx4cIbz2VIIGOYbN6dnV2aQqw9GKQG29ETLwCoy+OtLaixEaV615IIJ EqLdQLxbaqz5Ik23tC2PTXLr/6Y3CAMOyO/k4V+W+XUnglilOJ4BNnb0BsJK QbMcPmYsNd; Authentication-Results: sj-dkim-2; header.From=rdreier@cisco.com; dkim=pass ( sig from cisco.com/sjdkim2002 verified; ); Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > If mlx4_create_eq() would fail for one of EQ's assigned for > completion handling, the code would try to free the same EQ > we failed to create. > The crash was found by Christoph Lameter Thanks, good catch. However looking at the code it seems that a simpler way to fix this would be as below. Can you confirm that this works too? --- drivers/net/mlx4/eq.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" 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/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c index 8830dcb..033817e 100644 --- a/drivers/net/mlx4/eq.c +++ b/drivers/net/mlx4/eq.c @@ -677,12 +677,12 @@ err_out_async: mlx4_free_eq(dev, &priv->eq_table.eq[dev->caps.num_comp_vectors]); err_out_comp: - i = dev->caps.num_comp_vectors - 1; + i = dev->caps.num_comp_vectors; err_out_unmap: - while (i >= 0) { - mlx4_free_eq(dev, &priv->eq_table.eq[i]); + while (i > 0) { --i; + mlx4_free_eq(dev, &priv->eq_table.eq[i]); } mlx4_unmap_clr_int(dev); mlx4_free_irqs(dev);