[ldv-project] [PATCH] natsemi: add checks for dma mapping errors
David Miller
davem at davemloft.net
Sat Dec 19 05:36:07 MSK 2015
From: Alexey Khoroshilov <khoroshilov at ispras.ru>
Date: Sat, 19 Dec 2015 00:55:37 +0300
> @@ -2093,6 +2099,10 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
> np->tx_skbuff[entry] = skb;
> np->tx_dma[entry] = pci_map_single(np->pci_dev,
> skb->data,skb->len, PCI_DMA_TODEVICE);
> + if (pci_dma_mapping_error(np->pci_dev, np->tx_dma[entry])) {
> + np->tx_skbuff[entry] = NULL;
> + return NETDEV_TX_BUSY;
> + }
>
> np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]);
>
Returning NETDEV_TX_BUSY and freeing the SKB will crash the system.
NETDEV_TX_BUSY is only for buggy drivers that do not manage their
TX ring busy condition correctly, and thus need retries.
More information about the ldv-project
mailing list