From: Rabin Vincent <rabin@rab.in>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Rabin Vincent <rabin.vincent@axis.com>,
mina86@mina86.com, akpm@linux-foundation.org,
linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Rabin Vincent <rabinv@axis.com>
Subject: Re: [PATCH 2/2] ARM: dma-mapping: fix alloc/free for coherent + CMA + gfp=0
Date: Tue, 23 Feb 2016 16:23:53 +0100 [thread overview]
Message-ID: <20160223152353.GA22447@lnxrabinv.se.axis.com> (raw)
In-Reply-To: <20160219140600.GW19428@n2100.arm.linux.org.uk>
On Fri, Feb 19, 2016 at 02:06:00PM +0000, Russell King - ARM Linux wrote:
> On Fri, Feb 19, 2016 at 09:12:04AM +0100, Rabin Vincent wrote:
> > Given a device which uses arm_coherent_dma_ops and on which
> > dev_get_cma_area(dev) returns non-NULL, the following usage of the DMA
> > API with gfp=0 results in a memory leak and memory corruption.
> >
> > p = dma_alloc_coherent(dev, sz, &dma, 0);
> > if (p)
> > dma_free_coherent(dev, sz, p, dma);
> >
> > The memory leak is because the alloc allocates using
> > __alloc_simple_buffer() but the free attempts
> > dma_release_from_contiguous(), which does not do free anything since the
> > page is not in the CMA area.
>
> I'd really like to see a better solution to this problem: over the course
> of the years, I've seen a number of patches that rearrange the test order
> at allocation time because of some problem or the other.
>
> What we need is a better way to ensure that we use the correct release
> functionality - having two independent set of tests where the order
> matters is really not very good.
I've sent a v2 of this series which refactors the code so that we no
longer have two independent sets of tests.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-02-23 15:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-19 8:12 [PATCH 1/2] mm: cma: split out in_cma check to separate function Rabin Vincent
2016-02-19 8:12 ` [PATCH 2/2] ARM: dma-mapping: fix alloc/free for coherent + CMA + gfp=0 Rabin Vincent
2016-02-19 13:50 ` Michal Nazarewicz
2016-02-23 15:30 ` Rabin Vincent
2016-02-19 14:06 ` Russell King - ARM Linux
2016-02-23 15:23 ` Rabin Vincent [this message]
2016-02-19 13:46 ` [PATCH 1/2] mm: cma: split out in_cma check to separate function Michal Nazarewicz
2016-02-19 21:23 ` Andrew Morton
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=20160223152353.GA22447@lnxrabinv.se.axis.com \
--to=rabin@rab.in \
--cc=akpm@linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@arm.linux.org.uk \
--cc=mina86@mina86.com \
--cc=rabin.vincent@axis.com \
--cc=rabinv@axis.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