linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andrea merello <andrea.merello@gmail.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, Larry.Finger@lwfinger.net,
	"andrea.merello" <andrea.merello@gmail.com>
Subject: [PATCH 3/4] Add error check for pci_map_single return value in rtl8180 TX path
Date: Wed,  5 Feb 2014 22:38:06 +0100	[thread overview]
Message-ID: <1391636287-17712-4-git-send-email-andrea.merello@gmail.com> (raw)
In-Reply-To: <1391636287-17712-1-git-send-email-andrea.merello@gmail.com>

From: "andrea.merello" <andrea.merello@gmail.com>

Orignal code will not detect a DMA mapping failure, causing the HW
to attempt a DMA from an invalid address.

This patch add the error check and eventually simply drops the TX
packet if we can't map it for DMA.

Signed-off-by: andrea.merello <andrea.merello@gmail.com>
Signed-off-by: andrea merello <andrea.merello@gmail.com>
---
 drivers/net/wireless/rtl818x/rtl8180/dev.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
index 1c6ac25..9645ed2 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
@@ -276,6 +276,13 @@ static void rtl8180_tx(struct ieee80211_hw *dev,
 	mapping = pci_map_single(priv->pdev, skb->data,
 				 skb->len, PCI_DMA_TODEVICE);
 
+	if (pci_dma_mapping_error(priv->pdev, mapping)) {
+		kfree_skb(skb);
+		dev_err(&priv->pdev->dev, "TX DMA mapping error\n");
+		return;
+
+	}
+
 	tx_flags = RTL818X_TX_DESC_FLAG_OWN | RTL818X_TX_DESC_FLAG_FS |
 		   RTL818X_TX_DESC_FLAG_LS |
 		   (ieee80211_get_tx_rate(dev, info)->hw_value << 24) |
-- 
1.8.3.2


  parent reply	other threads:[~2014-02-05 21:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05 21:38 [PATCH 0/4] rtl818x: port fixes from rtl8187se merge process andrea merello
2014-02-05 21:38 ` [PATCH 1/4] In rtl8180/rtl8187 drivers, few register bit definitions have misleading names. Fix them andrea merello
2014-02-06 20:30   ` Larry Finger
2014-02-05 21:38 ` [PATCH 2/4] Add error check for pci_map_single return value in rtl8180 RX path andrea merello
2014-02-06 20:33   ` Larry Finger
2014-02-05 21:38 ` andrea merello [this message]
2014-02-06 20:35   ` [PATCH 3/4] Add error check for pci_map_single return value in rtl8180 TX path Larry Finger
2014-02-05 21:38 ` [PATCH 4/4] Write beacon interval register when beacon interval changes andrea merello

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=1391636287-17712-4-git-send-email-andrea.merello@gmail.com \
    --to=andrea.merello@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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).