All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mlx4: Fix access to freed memory
@ 2009-09-15 10:52 Vitaliy Gusev
  2009-09-15 18:23 ` Roland Dreier
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaliy Gusev @ 2009-09-15 10:52 UTC (permalink / raw)
  To: David Miller; +Cc: Jack Morgenstein, Roland Dreier, netdev

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");
+		}
 	}
 }
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mlx4: Fix access to freed memory
  2009-09-15 10:52 [PATCH] mlx4: Fix access to freed memory Vitaliy Gusev
@ 2009-09-15 18:23 ` Roland Dreier
  2009-09-16  7:00   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Roland Dreier @ 2009-09-15 18:23 UTC (permalink / raw)
  To: Vitaliy Gusev; +Cc: David Miller, Jack Morgenstein, Roland Dreier, netdev


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

Good catch.  Dave, if you want me to take this, let me know, otherwise:

Acked-by: Roland Dreier <rolandd@cisco.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mlx4: Fix access to freed memory
  2009-09-15 18:23 ` Roland Dreier
@ 2009-09-16  7:00   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-09-16  7:00 UTC (permalink / raw)
  To: rdreier; +Cc: vgusev, jackm, rolandd, netdev

From: Roland Dreier <rdreier@cisco.com>
Date: Tue, 15 Sep 2009 11:23:33 -0700

> 
>  > 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>
> 
> Good catch.  Dave, if you want me to take this, let me know, otherwise:
> 
> Acked-by: Roland Dreier <rolandd@cisco.com>

I've got it, thanks everyone.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-16  7:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-15 10:52 [PATCH] mlx4: Fix access to freed memory Vitaliy Gusev
2009-09-15 18:23 ` Roland Dreier
2009-09-16  7:00   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.