summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJitendra Kalsaria <jitendra.kalsaria@qlogic.com>2012-07-10 14:57:36 +0000
committerDavid S. Miller <davem@davemloft.net>2012-07-10 23:28:33 -0700
commitf5c4441cd80123c0f13fca75afc811c9c2b64add (patch)
tree746b0daf87c739e9881d95e42f4bfaed5e7955a5
parenta7db9ad1d48b502613f96054f21b107a8403237a (diff)
downloadop-kernel-dev-f5c4441cd80123c0f13fca75afc811c9c2b64add.zip
op-kernel-dev-f5c4441cd80123c0f13fca75afc811c9c2b64add.tar.gz
qlge: Fixed double pci free upon tx_ring->q allocation failure.
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 5cfba6a..bccbc4e 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -2708,10 +2708,9 @@ static int ql_alloc_tx_resources(struct ql_adapter *qdev,
&tx_ring->wq_base_dma);
if ((tx_ring->wq_base == NULL) ||
- tx_ring->wq_base_dma & WQ_ADDR_ALIGN) {
- netif_err(qdev, ifup, qdev->ndev, "tx_ring alloc failed.\n");
- return -ENOMEM;
- }
+ tx_ring->wq_base_dma & WQ_ADDR_ALIGN)
+ goto pci_alloc_err;
+
tx_ring->q =
kmalloc(tx_ring->wq_len * sizeof(struct tx_ring_desc), GFP_KERNEL);
if (tx_ring->q == NULL)
@@ -2721,6 +2720,9 @@ static int ql_alloc_tx_resources(struct ql_adapter *qdev,
err:
pci_free_consistent(qdev->pdev, tx_ring->wq_size,
tx_ring->wq_base, tx_ring->wq_base_dma);
+ tx_ring->wq_base = NULL;
+pci_alloc_err:
+ netif_err(qdev, ifup, qdev->ndev, "tx_ring alloc failed.\n");
return -ENOMEM;
}
OpenPOWER on IntegriCloud