diff options
author | andrea.merello <andrea.merello@gmail.com> | 2014-02-05 16:38:06 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-02-06 14:35:53 -0500 |
commit | 348f7d4adee97f222e3ad9ff97956ca3793d11c6 (patch) | |
tree | 150c5d381aa5e34986d0f99b7a9ee4e095cb150b /drivers/net | |
parent | 2b4db05e7e2f1efc71e36a9dc1adf5ba164a2330 (diff) |
rtl8180: Add error check for pci_map_single return value in TX path
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: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8180/dev.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index fad616a0fa37..3867d1470b36 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, | |||
276 | mapping = pci_map_single(priv->pdev, skb->data, | 276 | mapping = pci_map_single(priv->pdev, skb->data, |
277 | skb->len, PCI_DMA_TODEVICE); | 277 | skb->len, PCI_DMA_TODEVICE); |
278 | 278 | ||
279 | if (pci_dma_mapping_error(priv->pdev, mapping)) { | ||
280 | kfree_skb(skb); | ||
281 | dev_err(&priv->pdev->dev, "TX DMA mapping error\n"); | ||
282 | return; | ||
283 | |||
284 | } | ||
285 | |||
279 | tx_flags = RTL818X_TX_DESC_FLAG_OWN | RTL818X_TX_DESC_FLAG_FS | | 286 | tx_flags = RTL818X_TX_DESC_FLAG_OWN | RTL818X_TX_DESC_FLAG_FS | |
280 | RTL818X_TX_DESC_FLAG_LS | | 287 | RTL818X_TX_DESC_FLAG_LS | |
281 | (ieee80211_get_tx_rate(dev, info)->hw_value << 24) | | 288 | (ieee80211_get_tx_rate(dev, info)->hw_value << 24) | |