Commit d686159e authored by Jack Morgenstein's avatar Jack Morgenstein Committed by Roland Dreier
Browse files

IB/mthca: Fix access to freed memory in catastrophic event handling

catas_reset() uses a pointer to mthca_dev, but mthca_dev is not valid
after the call to __mthca_restart_one().

Based on a similar patch for mlx4 (634354d7

, "mlx4: Fix access to
freed memory") by Vitaliy Gusev <>
Signed-off-by: default avatarJack Morgenstein <>
Signed-off-by: default avatarRoland Dreier <>
parent 86d71014
......@@ -68,11 +68,16 @@ static void catas_reset(struct work_struct *work)
list_for_each_entry_safe(dev, tmpdev, &tlist, catas_err.list) {
struct pci_dev *pdev = dev->pdev;
ret = __mthca_restart_one(dev->pdev);
/* 'dev' now is not valid */
if (ret)
mthca_err(dev, "Reset failed (%d)\n", ret);
mthca_dbg(dev, "Reset succeeded\n");
printk(KERN_ERR "mthca %s: Reset failed (%d)\n",
pci_name(pdev), ret);
else {
struct mthca_dev *d = pci_get_drvdata(pdev);
mthca_dbg(d, "Reset succeeded\n");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment