Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1295271

Re: [PATCH] natsemi: add checks for dma mapping errors

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] natsemi: add checks for dma mapping errors
Date 2015-12-19 03:40 +0100
Message-ID <qHfB8-5yW-7@gated-at.bofh.it> (permalink)
References <qHbe9-2K9-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Alexey Khoroshilov <khoroshilov@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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] natsemi: add checks for dma mapping errors Alexey Khoroshilov <khoroshilov@ispras.ru> - 2015-12-18 23:00 +0100
  Re: [PATCH] natsemi: add checks for dma mapping errors David Miller <davem@davemloft.net> - 2015-12-19 03:40 +0100
    Re: [PATCH] natsemi: add checks for dma mapping errors Alexey Khoroshilov <khoroshilov@ispras.ru> - 2015-12-19 13:10 +0100
      [PATCH v2] natsemi: add checks for dma mapping errors Alexey Khoroshilov <khoroshilov@ispras.ru> - 2015-12-19 13:20 +0100
        Re: [PATCH v2] natsemi: add checks for dma mapping errors David Miller <davem@davemloft.net> - 2015-12-19 19:00 +0100
      Re: [PATCH] natsemi: add checks for dma mapping errors David Miller <davem@davemloft.net> - 2015-12-19 19:00 +0100

csiph-web