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>
This commit is contained in:
parent
2b4db05e7e
commit
348f7d4ade
|
@ -276,6 +276,13 @@ static void rtl8180_tx(struct ieee80211_hw *dev,
|
||||||
mapping = pci_map_single(priv->pdev, skb->data,
|
mapping = pci_map_single(priv->pdev, skb->data,
|
||||||
skb->len, PCI_DMA_TODEVICE);
|
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 |
|
tx_flags = RTL818X_TX_DESC_FLAG_OWN | RTL818X_TX_DESC_FLAG_FS |
|
||||||
RTL818X_TX_DESC_FLAG_LS |
|
RTL818X_TX_DESC_FLAG_LS |
|
||||||
(ieee80211_get_tx_rate(dev, info)->hw_value << 24) |
|
(ieee80211_get_tx_rate(dev, info)->hw_value << 24) |
|
||||||
|
|
Loading…
Reference in a new issue