linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Will Deacon <will.deacon@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
	hch@lst.de, linux-arm-kernel@lists.infradead.org,
	m.szyprowski@samsung.com
Subject: Re: [PATCH] arm64: dma-mapping: Fix FORCE_CONTIGUOUS buffer clearing
Date: Tue, 11 Dec 2018 11:55:27 +0000	[thread overview]
Message-ID: <20181211115526.GD35824@arrakis.emea.arm.com> (raw)
In-Reply-To: <20181210193618.GC8923@edgewater-inn.cambridge.arm.com>

On Mon, Dec 10, 2018 at 07:36:18PM +0000, Will Deacon wrote:
> On Mon, Dec 10, 2018 at 07:33:31PM +0000, Robin Murphy wrote:
> > We need to invalidate the caches *before* clearing the buffer via the
> > non-cacheable alias, else in the worst case __dma_flush_area() may
> > write back dirty lines over the top of our nice new zeros.
> > 
> > Fixes: dd65a941f6ba ("arm64: dma-mapping: clear buffers allocated with FORCE_CONTIGUOUS flag")
> > Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> > ---
> >  arch/arm64/mm/dma-mapping.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
> > index a3ac26284845..a53704406099 100644
> > --- a/arch/arm64/mm/dma-mapping.c
> > +++ b/arch/arm64/mm/dma-mapping.c
> > @@ -429,9 +429,9 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size,
> >  						   prot,
> >  						   __builtin_return_address(0));
> >  		if (addr) {
> > -			memset(addr, 0, size);
> >  			if (!coherent)
> >  				__dma_flush_area(page_to_virt(page), iosize);
> > +			memset(addr, 0, size);
> >  		} else {
> >  			iommu_dma_unmap_page(dev, *handle, iosize, 0, attrs);
> >  			dma_release_from_contiguous(dev, page,
> 
> Oh crikey, well spotted!
> 
> Acked-by: Will Deacon <will.deacon@arm.com>
> 
> Catalin, please take this with a Cc stable.

Queued. Thanks.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2018-12-11 11:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 19:33 [PATCH] arm64: dma-mapping: Fix FORCE_CONTIGUOUS buffer clearing Robin Murphy
2018-12-10 19:36 ` Will Deacon
2018-12-11 11:55   ` Catalin Marinas [this message]
2018-12-12  7:31 ` Chintan Pandya
2018-12-12  7:37   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181211115526.GD35824@arrakis.emea.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=hch@lst.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).