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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150408.122520.1452310225826617365.davem@davemloft.net>
Date:	Wed, 08 Apr 2015 12:25:20 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	amirv@...lanox.com
Cc:	netdev@...r.kernel.org, yevgenyp@...lanox.com, saeedm@...lanox.com,
	ogerlitz@...lanox.com, achiad@...lanox.com, idos@...lanox.com
Subject: Re: [PATCH net-next 03/11] net/mlx5_core: Virtually extend
 work/completion queue buffers by one page

From: Amir Vadai <amirv@...lanox.com>
Date: Wed,  8 Apr 2015 17:51:17 +0300

> +	for (i = 0; i < buf->nbufs; i++) {
> +		buf->page_list[i].buf =
> +			dma_zalloc_coherent(&dev->pdev->dev, PAGE_SIZE,
> +					    &t, GFP_KERNEL);
> +		if (!buf->page_list[i].buf)
> +			goto err_free;
> +
> +		buf->page_list[i].map = t;
> +	}
> +
> +	if (BITS_PER_LONG == 64) {
> +		struct page **pages;
> +		int npages = buf->nbufs + (virtual_extension ? 1 : 0);
> +
> +		pages = kcalloc(npages, sizeof(*pages), GFP_KERNEL);
> +		if (!pages)
> +			goto err_free;
> +
> +		for (i = 0; i < buf->nbufs; i++)
> +			pages[i] = virt_to_page(buf->page_list[i].buf);
> +
> +		if (virtual_extension)
> +			pages[buf->nbufs] = pages[0];
> +
> +		buf->direct.buf = vmap(pages, npages, VM_MAP, PAGE_KERNEL);

I'm sorry but I'm going to require that you fix this mis-use of the DMA
API first.

You absolutely cannot vmap() pages backing coherent DMA memory, the
memory is mapped in a particular way by dma_*_coherent() and you must
therefore only use the virtual address provided to you by that
function to access the memory.
--
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