[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1390554723-15285-1-git-send-email-shangw@linux.vnet.ibm.com>
Date: Fri, 24 Jan 2014 17:12:03 +0800
From: Gavin Shan <shangw@...ux.vnet.ibm.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, Gavin Shan <shangw@...ux.vnet.ibm.com>
Subject: [PATCH] net/cxgb4: Fix referencing freed adapter
The adapter is freed before we check its flags. It was caused
by commit 144be3d ("net/cxgb4: Avoid disabling PCI device for
towice"). The problem was reported by Intel's "0-day" tool.
The patch fixes it to avoid reverting commit 144be3d.
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Gavin Shan <shangw@...ux.vnet.ibm.com>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 139a704..43ab35f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -6163,13 +6163,13 @@ static void remove_one(struct pci_dev *pdev)
iounmap(adapter->regs);
if (!is_t4(adapter->params.chip))
iounmap(adapter->bar2);
- kfree(adapter);
pci_disable_pcie_error_reporting(pdev);
if ((adapter->flags & DEV_ENABLED)) {
pci_disable_device(pdev);
adapter->flags &= ~DEV_ENABLED;
}
pci_release_regions(pdev);
+ kfree(adapter);
} else
pci_release_regions(pdev);
}
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists