public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Vitaliy Gusev <vgusev@openvz•org>
To: David Miller <davem@davemloft•net>
Cc: Jack Morgenstein <jackm@dev•mellanox.co.il>,
	Roland Dreier <rolandd@cisco•com>,
	netdev@vger•kernel.org
Subject: [PATCH] mlx4: Fix access to freed memory
Date: Tue, 15 Sep 2009 14:52:40 +0400	[thread overview]
Message-ID: <200909151452.41206.vgusev@openvz.org> (raw)

catas_reset() uses pointer to mlx4_priv, but mlx4_priv is not valid after
call mlx4_restart_one().

Signed-off-by: Vitaliy Gusev <vgusev@openvz•org>

diff --git a/drivers/net/mlx4/catas.c b/drivers/net/mlx4/catas.c
index aa9674b..f599294 100644
--- a/drivers/net/mlx4/catas.c
+++ b/drivers/net/mlx4/catas.c
@@ -96,12 +96,17 @@ static void catas_reset(struct work_struct *work)
 	spin_unlock_irq(&catas_lock);
 
 	list_for_each_entry_safe(priv, tmppriv, &tlist, catas_err.list) {
+		struct pci_dev *pdev = priv->dev.pdev;
+
 		ret = mlx4_restart_one(priv->dev.pdev);
-		dev = &priv->dev;
+		/* 'priv' now is not valid */
 		if (ret)
-			mlx4_err(dev, "Reset failed (%d)\n", ret);
-		else
+			printk(KERN_ERR "mlx4 %s: Reset failed (%d)\n",
+				pci_name(pdev), ret);
+		else {
+			dev  = pci_get_drvdata(pdev);
 			mlx4_dbg(dev, "Reset succeeded\n");
+		}
 	}
 }
 

             reply	other threads:[~2009-09-15 11:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-15 10:52 Vitaliy Gusev [this message]
2009-09-15 18:23 ` [PATCH] mlx4: Fix access to freed memory Roland Dreier
2009-09-16  7:00   ` David Miller

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=200909151452.41206.vgusev@openvz.org \
    --to=vgusev@openvz$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=jackm@dev$(echo .)mellanox.co.il \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rolandd@cisco$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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