diff options
author | Gavin Shan <shangw@linux.vnet.ibm.com> | 2014-01-24 09:12:03 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-25 00:00:37 (GMT) |
commit | 8b662fe70c68282f78482dc272df0c4f355e49f5 (patch) | |
tree | 769c0d31b2b0b5dbcd24ea8f82ece34dc3367913 /drivers/net | |
parent | 33d99113b1102c2d2f8603b9ba72d89d915c13f5 (diff) | |
download | linux-8b662fe70c68282f78482dc272df0c4f355e49f5.tar.xz |
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@oracle.com>
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); } |