netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Cc: netdev@vger.kernel.org, general@lists.openfabrics.org,
	Christoph Lameter <cl@linux-foundation.org>
Subject: Re: [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table
Date: Tue, 09 Jun 2009 13:46:23 -0700	[thread overview]
Message-ID: <adavdn53zkw.fsf@cisco.com> (raw)
In-Reply-To: <4A2BD9B9.6000802@mellanox.co.il> (Yevgeny Petrilin's message of "Sun, 07 Jun 2009 18:16:09 +0300")


 > 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(-)

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);

  parent reply	other threads:[~2009-06-09 20:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-07 15:16 [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table Yevgeny Petrilin
2009-06-08  7:40 ` David Miller
2009-06-09 20:46 ` Roland Dreier [this message]
2009-06-10  6:52   ` Yevgeny Petrilin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adavdn53zkw.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=cl@linux-foundation.org \
    --cc=general@lists.openfabrics.org \
    --cc=netdev@vger.kernel.org \
    --cc=yevgenyp@mellanox.co.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).