From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, ron.mercer@qlogic.com,
Dept_NX_Linux_NIC_Driver@qlogic.com,
Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Subject: [PATCH net-next 6/9] qlge: Fixed double pci free upon tx_ring->q allocation failure.
Date: Tue, 10 Jul 2012 20:57:36 -0400 [thread overview]
Message-ID: <1341968259-18931-7-git-send-email-jitendra.kalsaria@qlogic.com> (raw)
In-Reply-To: <1341968259-18931-1-git-send-email-jitendra.kalsaria@qlogic.com>
From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
---
drivers/net/ethernet/qlogic/qlge/qlge_main.c | 10 ++++++----
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 ee3457e..cf6887a 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -2710,10 +2710,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)
@@ -2723,6 +2722,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;
}
--
1.7.1
next prev parent reply other threads:[~2012-07-11 1:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-11 0:57 [PATCH net-next 0/9] qlge: bug fix Jitendra Kalsaria
2012-07-11 0:57 ` [PATCH net-next 1/9] qlge: Fix TX queue stoppage due to full condition Jitendra Kalsaria
2012-07-11 0:57 ` [PATCH net-next 2/9] qlge: Cleanup atomic queue threshold check Jitendra Kalsaria
2012-07-11 0:57 ` [PATCH net-next 3/9] qlge: Fix ethtool WOL calls to operate only on devices that support WOL Jitendra Kalsaria
2012-07-11 0:57 ` [PATCH net-next 4/9] qlge: Clean up ethtool set WOL routine Jitendra Kalsaria
2012-07-11 0:57 ` [PATCH net-next 5/9] qlge: Added missing case statement to ethtool get_strings Jitendra Kalsaria
2012-07-11 0:57 ` Jitendra Kalsaria [this message]
2012-07-11 0:57 ` [PATCH net-next 7/9] qlge: Moving low level frame error to ethtool statistics Jitendra Kalsaria
2012-07-11 0:57 ` [PATCH net-next 8/9] qlge: Refactoring of ethtool stats Jitendra Kalsaria
2012-07-11 0:57 ` [PATCH net-next 9/9] qlge: Bumped driver version to 1.00.00.31 Jitendra Kalsaria
2012-07-11 6:28 ` [PATCH net-next 0/9] qlge: bug fix David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1341968259-18931-7-git-send-email-jitendra.kalsaria@qlogic.com \
--to=jitendra.kalsaria@qlogic.com \
--cc=Dept_NX_Linux_NIC_Driver@qlogic.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ron.mercer@qlogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).