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


Groups > linux.kernel > #1624815

Re: [PATCH] net: natsemi: ns83820: add checks for dma mapping error

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] net: natsemi: ns83820: add checks for dma mapping error
Date 2017-04-17 21:20 +0200
Message-ID <txklQ-4zD-9@gated-at.bofh.it> (permalink)
References <twim5-71X-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date: Sat, 15 Apr 2017 01:50:50 +0300

> @@ -1136,6 +1141,10 @@ static netdev_tx_t ns83820_hard_start_xmit(struct sk_buff *skb,
>  	if (nr_frags)
>  		len -= skb->data_len;
>  	buf = pci_map_single(dev->pci_dev, skb->data, len, PCI_DMA_TODEVICE);
> +	if (pci_dma_mapping_error(dev->pci_dev, buf)) {
> +		dev_kfree_skb_any(skb);
> +		return NETDEV_TX_OK;
> +	}
>  
>  	first_desc = dev->tx_descs + (free_idx * DESC_SIZE);
>  

You need to also add this check for the skb_map_dma_frag() calls below
this line, and therefore you'll need to add unwind on such a failure.

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


Thread

[PATCH] net: natsemi: ns83820: add checks for dma mapping error Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-04-15 01:00 +0200
  Re: [PATCH] net: natsemi: ns83820: add checks for dma mapping error David Miller <davem@davemloft.net> - 2017-04-17 21:20 +0200
    [PATCH v2] net: natsemi: ns83820: add checks for dma mapping error Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-04-22 15:10 +0200
      Re: [PATCH v2] net: natsemi: ns83820: add checks for dma mapping  error Francois Romieu <romieu@fr.zoreil.com> - 2017-04-22 21:30 +0200
      Re: [PATCH v2] net: natsemi: ns83820: add checks for dma mapping  error David Miller <davem@davemloft.net> - 2017-04-24 20:10 +0200

csiph-web