From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Greg Rose <gregory.v.rose@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 6/8] ixgbevf: Check for error on dma_map_single call
Date: Tue, 23 Oct 2012 03:24:45 -0700 [thread overview]
Message-ID: <1350987887-16161-7-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1350987887-16161-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Greg Rose <gregory.v.rose@intel.com>
Ignoring the return value from a call to the kernel dma_map API functions
can cause data corruption and system instability. Check the return value
and take appropriate action.
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 537ed19..805e02c 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -359,6 +359,12 @@ static void ixgbevf_alloc_rx_buffers(struct ixgbevf_adapter *adapter,
bi->dma = dma_map_single(&pdev->dev, skb->data,
rx_ring->rx_buf_len,
DMA_FROM_DEVICE);
+ if (dma_mapping_error(&pdev->dev, bi->dma)) {
+ dev_kfree_skb(skb);
+ bi->skb = NULL;
+ dev_err(&pdev->dev, "RX DMA map failed\n");
+ break;
+ }
}
rx_desc->read.pkt_addr = cpu_to_le64(bi->dma);
@@ -2817,10 +2823,10 @@ static int ixgbevf_tx_map(struct ixgbevf_ring *tx_ring,
tx_buffer_info->dma =
skb_frag_dma_map(tx_ring->dev, frag,
offset, size, DMA_TO_DEVICE);
- tx_buffer_info->mapped_as_page = true;
if (dma_mapping_error(tx_ring->dev,
tx_buffer_info->dma))
goto dma_error;
+ tx_buffer_info->mapped_as_page = true;
tx_buffer_info->next_to_watch = i;
len -= size;
--
1.7.11.7
next prev parent reply other threads:[~2012-10-23 10:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-23 10:24 [net-next 0/8][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-10-23 10:24 ` [net-next 1/8] e1000e: Minimum packet size must be 17 bytes Jeff Kirsher
2012-10-23 15:25 ` David Laight
2012-10-23 16:37 ` Alexander Duyck
2012-10-23 10:24 ` [net-next 2/8] maintainers: update with official intel support link, new maintainer Jeff Kirsher
2012-10-23 13:25 ` Joe Perches
2012-10-24 4:32 ` Jeff Kirsher
2012-10-24 4:52 ` Joe Perches
2012-10-24 5:13 ` Jeff Kirsher
2012-10-24 17:31 ` Rick Jones
2012-10-23 10:24 ` [net-next 3/8] igb: Update get cable length function for i210/i211 Jeff Kirsher
2012-10-23 10:24 ` [net-next 4/8] igb: Update version Jeff Kirsher
2012-10-23 10:24 ` [net-next 5/8] ixgbevf: make netif_napi_add and netif_napi_del symmetric Jeff Kirsher
2012-10-23 10:24 ` Jeff Kirsher [this message]
2012-10-23 10:24 ` [net-next 7/8] ixgbevf: fix softirq-safe to unsafe splat on internal mbx_lock Jeff Kirsher
2012-10-23 10:24 ` [net-next 8/8] ixgbevf: Update version string Jeff Kirsher
2012-10-23 17:28 ` [net-next 0/8][pull request] Intel Wired LAN Driver Updates 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=1350987887-16161-7-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=gregory.v.rose@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.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).