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, 8 Apr 2015 20:44:10 +0300
From:	Amir Vadai <amirv@...lanox.com>
To:	David Miller <davem@...emloft.net>
Cc:	Amir Vadai <amirv@...lanox.com>, netdev <netdev@...r.kernel.org>,
	Yevgeny Petrilin <yevgenyp@...lanox.com>,
	Saeed Mahameed <saeedm@...lanox.com>,
	Or Gerlitz <ogerlitz@...lanox.com>, achiad@...lanox.com,
	Ido Shamay <idos@...lanox.com>
Subject: Re: [PATCH net-next 03/11] net/mlx5_core: Virtually extend
 work/completion queue buffers by one page

On Wed, Apr 8, 2015 at 7:25 PM, David Miller <davem@...emloft.net> wrote:
> 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.

Right - will be fixed in V1

Thanks,
Amir

> --
> 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