lkml.org 
[lkml]   [2015]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA
On Mon, Jun 29, 2015 at 11:46:04AM +0100, Russell King - ARM Linux wrote:
> On Mon, Jun 29, 2015 at 11:37:37AM +0100, Catalin Marinas wrote:
> > I forgot about the arm_dma_mmap fix here:
> >
> > https://lkml.org/lkml/2015/5/7/512
> >
> > So we either fix both cases by changing __get_dma_pgprot() or just go
> > for Mike's and your patches as above. It's up to Russell.
>
> I'd prefer the "least code" option. :)
>
> > At some point, we could do with some more clean-up in the dma-mapping.c.
> > For example, both __alloc_simple_buffer() and __alloc_from_contiguous()
> > end up calling __dma_clear_buffer() even when not necessary (cacheable
> > mapping). Not too bad though as this is only done when setting up the
> > buffer.
>
> The reason we always clear the buffer is that we can't be sure that a
> driver will not map a buffer allocated by dma_alloc_coherent() into
> userspace without it first being initialised. There have been drivers
> which do this (ALSA in particular.) I haven't checked whether this
> instance still does this, but it used to - and the problem is once
> one instance exists, it gets copied...

You are right, the memset'ing is probably still necessary to patch
potential security holes. The cache flushing is not for coherent buffers
(sometimes this may be more expensive than the memset itself, though
lost in the noise if only done once).

--
Catalin


\
 
 \ /
  Last update: 2015-06-29 13:21    [W:0.118 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site