From: Rasesh Mody <rmody@brocade.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <adapter_linux_open_src_team@brocade.com>,
Rasesh Mody <rmody@brocade.com>,
Gurunatha Karaje <gkaraje@brocade.com>
Subject: [net-next 11/12] bna: SKB PCI UNMAP Fix
Date: Mon, 22 Aug 2011 15:41:08 -0700 [thread overview]
Message-ID: <1314052869-7407-12-git-send-email-rmody@brocade.com> (raw)
In-Reply-To: <1314052869-7407-1-git-send-email-rmody@brocade.com>
Change details:
- Found a leak in sk_buff unmapping of PCI dma addresses where boundary
conditions are not properly handled in freeing all Tx buffers. Freeing
of all Tx buffers is done considering sk_buffs data and fragments can
be mapped at the boundary.
Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
drivers/net/ethernet/brocade/bna/bnad.c | 39 ++++++++-----------------------
1 files changed, 10 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index d94497d..6ae531e 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -133,39 +133,20 @@ bnad_free_all_txbufs(struct bnad *bnad,
struct bnad_unmap_q *unmap_q = tcb->unmap_q;
struct bnad_skb_unmap *unmap_array;
struct sk_buff *skb = NULL;
- int i;
+ int q;
unmap_array = unmap_q->unmap_array;
- unmap_cons = 0;
- while (unmap_cons < unmap_q->q_depth) {
- skb = unmap_array[unmap_cons].skb;
- if (!skb) {
- unmap_cons++;
+ for (q = 0; q < unmap_q->q_depth; q++) {
+ skb = unmap_array[q].skb;
+ if (!skb)
continue;
- }
- unmap_array[unmap_cons].skb = NULL;
-
- dma_unmap_single(&bnad->pcidev->dev,
- dma_unmap_addr(&unmap_array[unmap_cons],
- dma_addr), skb_headlen(skb),
- DMA_TO_DEVICE);
- dma_unmap_addr_set(&unmap_array[unmap_cons], dma_addr, 0);
- if (++unmap_cons >= unmap_q->q_depth)
- break;
+ unmap_cons = q;
+ BNAD_PCI_UNMAP_SKB(&bnad->pcidev->dev, unmap_array, unmap_cons,
+ unmap_q->q_depth, skb,
+ skb_shinfo(skb)->nr_frags);
- for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
- dma_unmap_page(&bnad->pcidev->dev,
- dma_unmap_addr(&unmap_array[unmap_cons],
- dma_addr),
- skb_shinfo(skb)->frags[i].size,
- DMA_TO_DEVICE);
- dma_unmap_addr_set(&unmap_array[unmap_cons], dma_addr,
- 0);
- if (++unmap_cons >= unmap_q->q_depth)
- break;
- }
dev_kfree_skb_any(skb);
}
}
--
1.7.1
next prev parent reply other threads:[~2011-08-22 22:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-22 22:40 [net-next 00/12] bna: Update bna driver version to 3.0.2.1 Rasesh Mody
2011-08-22 22:40 ` [net-next 01/12] bna: Naming Change and Minor Macro Fix Rasesh Mody
2011-08-22 22:40 ` [net-next 02/12] bna: PCI Probe Fix Rasesh Mody
2011-08-22 22:41 ` [net-next 03/12] bna: Interrupt Polling and NAPI Init Changes Rasesh Mody
2011-08-22 22:41 ` [net-next 04/12] bna: TX Path and RX Path Changes Rasesh Mody
2011-08-22 23:45 ` David Miller
2011-08-23 18:06 ` Rasesh Mody
2011-08-22 22:41 ` [net-next 05/12] bna: Formatting and Code Cleanup Rasesh Mody
2011-08-22 22:41 ` [net-next 06/12] bna: Initialization and Locking Fix Rasesh Mody
2011-08-22 22:41 ` [net-next 07/12] bna: Ethtool Enhancements and Fix Rasesh Mody
2011-08-22 22:41 ` [net-next 08/12] bna: Async Mode Tx Rx Init Fix Rasesh Mody
2011-08-22 22:41 ` [net-next 09/12] bna: MBOX IRQ Flag Check after Locking Rasesh Mody
2011-08-22 22:41 ` [net-next 10/12] bna: Queue Depth and SKB Unmap Array Fix Rasesh Mody
2011-08-22 22:41 ` Rasesh Mody [this message]
2011-08-22 22:41 ` [net-next 12/12] bna: Driver Version changed to 3.0.2.1 Rasesh Mody
-- strict thread matches above, loose matches on Subject: below --
2011-08-31 1:27 [net-next 00/12] bna: Update bna driver version " Rasesh Mody
2011-08-31 1:27 ` [net-next 11/12] bna: SKB PCI UNMAP Fix Rasesh Mody
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=1314052869-7407-12-git-send-email-rmody@brocade.com \
--to=rmody@brocade.com \
--cc=adapter_linux_open_src_team@brocade.com \
--cc=davem@davemloft.net \
--cc=gkaraje@brocade.com \
--cc=netdev@vger.kernel.org \
/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).