Skip to content

Commit

Permalink
mlx4: Fix access to freed memory
Browse files Browse the repository at this point in the history
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>
Acked-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vitaliy Gusev authored and David S. Miller committed Sep 16, 2009
1 parent 657e964 commit 634354d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/net/mlx4/catas.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}

Expand Down

0 comments on commit 634354d

Please sign in to comment.