From: Roel Kluin <roel.kluin@gmail.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
davem@davemloft.net, Anton Blanchard <anton@samba.org>,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Bruce Allan <bruce.w.allan@intel.com>,
PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>,
John Ronciak <john.ronciak@intel.com>,
Don Skidmore <donald.c.skidmore@intel.com>,
Yi Zou <yi.zou@intel.com>,
Alexander Duyck <alexander.h.duyck@intel.com>,
e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] e1000: Fix DMA mapping error handling on TX
Date: Thu, 04 Feb 2010 14:00:21 +0100 [thread overview]
Message-ID: <4B6AC4E5.4080104@gmail.com> (raw)
In-Reply-To: <4B5F1164.8030102@gmail.com>
These functions have off by one errors in their dma mapping error cleanup
paths. We decrement count and never clean the first successfully mapped
descriptor.
Reported-by: "Anton Blanchard" <anton@samba.org>
Reported-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
drivers/net/e1000e/netdev.c | 4 +---
drivers/net/igbvf/netdev.c | 4 +---
drivers/net/ixgb/ixgb_main.c | 4 +---
drivers/net/ixgbe/ixgbe_main.c | 4 +---
4 files changed, 4 insertions(+), 12 deletions(-)
My previous fix inadvertently introduced this change.
The e1000_tx_map() function in drivers/net/e1000/e1000_main.c is already
fixed by the patch sent by Anton Blanchard that can be found here:
http://www.mail-archive.com/e1000-devel@lists.sourceforge.net/msg02313.html
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 57f149b..57c3d44 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -3967,12 +3967,10 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
dma_error:
dev_err(&pdev->dev, "TX DMA map failed\n");
buffer_info->dma = 0;
- if (count)
- count--;
while (count--) {
if (i==0)
- i += tx_ring->count;
+ i = tx_ring->count;
i--;
buffer_info = &tx_ring->buffer_info[i];
e1000_put_txbuf(adapter, buffer_info);;
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index 2aa71a7..3b12603 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -2164,13 +2164,11 @@ dma_error:
buffer_info->length = 0;
buffer_info->next_to_watch = 0;
buffer_info->mapped_as_page = false;
- if (count)
- count--;
/* clear timestamp and dma mappings for remaining portion of packet */
while (count--) {
if (i==0)
- i += tx_ring->count;
+ i = tx_ring->count;
i--;
buffer_info = &tx_ring->buffer_info[i];
igbvf_put_txbuf(adapter, buffer_info);
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 593d1a4..de9b36c 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1363,12 +1363,10 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
dma_error:
dev_err(&pdev->dev, "TX DMA map failed\n");
buffer_info->dma = 0;
- if (count)
- count--;
while (count--) {
if (i==0)
- i += tx_ring->count;
+ i = tx_ring->count;
i--;
buffer_info = &tx_ring->buffer_info[i];
ixgb_unmap_and_free_tx_resource(adapter, buffer_info);
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index b5f64ad..1713258 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -5167,13 +5167,11 @@ dma_error:
tx_buffer_info->dma = 0;
tx_buffer_info->time_stamp = 0;
tx_buffer_info->next_to_watch = 0;
- if (count)
- count--;
/* clear timestamp and dma mappings for remaining portion of packet */
while (count--) {
if (i==0)
- i += tx_ring->count;
+ i = tx_ring->count;
i--;
tx_buffer_info = &tx_ring->tx_buffer_info[i];
ixgbe_unmap_and_free_tx_resource(adapter, tx_buffer_info);
prev parent reply other threads:[~2010-02-04 12:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-21 11:42 [PATCH 1/2] e1000: Fix DMA mapping error handling on TX Anton Blanchard
2010-01-21 11:44 ` [PATCH 2/2] e1000: Fix DMA mapping error handling on RX Anton Blanchard
2010-01-23 3:42 ` Jeff Kirsher
2010-01-23 3:40 ` [PATCH 1/2] e1000: Fix DMA mapping error handling on TX Jeff Kirsher
2010-01-24 0:47 ` Anton Blanchard
2010-01-24 3:58 ` Jeff Kirsher
2010-01-26 15:59 ` Roel Kluin
2010-02-04 13:00 ` Roel Kluin [this message]
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=4B6AC4E5.4080104@gmail.com \
--to=roel.kluin@gmail.com \
--cc=alexander.h.duyck@intel.com \
--cc=anton@samba.org \
--cc=bruce.w.allan@intel.com \
--cc=davem@davemloft.net \
--cc=donald.c.skidmore@intel.com \
--cc=e1000-devel@lists.sourceforge.net \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=john.ronciak@intel.com \
--cc=netdev@vger.kernel.org \
--cc=peter.p.waskiewicz.jr@intel.com \
--cc=yi.zou@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.