Commit f5c4441c authored by Jitendra Kalsaria's avatar Jitendra Kalsaria Committed by David S. Miller

qlge: Fixed double pci free upon tx_ring->q allocation failure.

Signed-off-by: default avatarJitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a7db9ad1
...@@ -2708,10 +2708,9 @@ static int ql_alloc_tx_resources(struct ql_adapter *qdev, ...@@ -2708,10 +2708,9 @@ static int ql_alloc_tx_resources(struct ql_adapter *qdev,
&tx_ring->wq_base_dma); &tx_ring->wq_base_dma);
if ((tx_ring->wq_base == NULL) || if ((tx_ring->wq_base == NULL) ||
tx_ring->wq_base_dma & WQ_ADDR_ALIGN) { tx_ring->wq_base_dma & WQ_ADDR_ALIGN)
netif_err(qdev, ifup, qdev->ndev, "tx_ring alloc failed.\n"); goto pci_alloc_err;
return -ENOMEM;
}
tx_ring->q = tx_ring->q =
kmalloc(tx_ring->wq_len * sizeof(struct tx_ring_desc), GFP_KERNEL); kmalloc(tx_ring->wq_len * sizeof(struct tx_ring_desc), GFP_KERNEL);
if (tx_ring->q == NULL) if (tx_ring->q == NULL)
...@@ -2721,6 +2720,9 @@ static int ql_alloc_tx_resources(struct ql_adapter *qdev, ...@@ -2721,6 +2720,9 @@ static int ql_alloc_tx_resources(struct ql_adapter *qdev,
err: err:
pci_free_consistent(qdev->pdev, tx_ring->wq_size, pci_free_consistent(qdev->pdev, tx_ring->wq_size,
tx_ring->wq_base, tx_ring->wq_base_dma); 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; return -ENOMEM;
} }
......
Markdown is supported
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