lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 6 Aug 2014 18:47:48 +0400
From:	Denis Kirjanov <kda@...ux-powerpc.org>
To:	Stanislaw Gruszka <sgruszka@...hat.com>
Cc:	netdev@...r.kernel.org, Hyong-Youb Kim <hykim@...i.com>
Subject: Re: [PATCH] myri10ge: check for pci_map_page errors

On 8/6/14, Stanislaw Gruszka <sgruszka@...hat.com> wrote:
> On IOMMU systems DMA mapping can fail, we need to check for that
> possibility.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@...hat.com>
> ---
>  drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 21
> ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> index f3d5d79..17f869a 100644
> --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c

You did miss the one in myri10ge_xmit
> @@ -872,6 +872,10 @@ static int myri10ge_dma_test(struct myri10ge_priv *mgp,
> int test_type)
>  		return -ENOMEM;
>  	dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE,
>  				   DMA_BIDIRECTIONAL);
> +	if (unlikely(pci_dma_mapping_error(mgp->pdev, dmatest_bus))) {
> +		__free_page(dmatest_page);
> +		return -ENOMEM;
> +	}
>
>  	/* Run a small DMA test.
>  	 * The magic multipliers to the length tell the firmware
> @@ -1293,6 +1297,7 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp,
> struct myri10ge_rx_buf *rx,
>  			int bytes, int watchdog)
>  {
>  	struct page *page;
> +	dma_addr_t bus;
>  	int idx;
>  #if MYRI10GE_ALLOC_SIZE > 4096
>  	int end_offset;
> @@ -1317,11 +1322,21 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp,
> struct myri10ge_rx_buf *rx,
>  					rx->watchdog_needed = 1;
>  				return;
>  			}
> +
> +			bus = pci_map_page(mgp->pdev, page, 0,
> +					   MYRI10GE_ALLOC_SIZE,
> +					   PCI_DMA_FROMDEVICE);
> +			if (unlikely(pci_dma_mapping_error(mgp->pdev, bus))) {
> +				__free_pages(page, MYRI10GE_ALLOC_ORDER);
> +				if (rx->fill_cnt - rx->cnt < 16)
> +					rx->watchdog_needed = 1;
> +				return;
> +			}
> +
>  			rx->page = page;
>  			rx->page_offset = 0;
> -			rx->bus = pci_map_page(mgp->pdev, page, 0,
> -					       MYRI10GE_ALLOC_SIZE,
> -					       PCI_DMA_FROMDEVICE);
> +			rx->bus = bus;
> +
>  		}
>  		rx->info[idx].page = rx->page;
>  		rx->info[idx].page_offset = rx->page_offset;
> --
> 1.9.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ