]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm/cma: make kmemleak ignore CMA regions
authorThierry Reding <treding@nvidia.com>
Sat, 13 Dec 2014 00:58:31 +0000 (16:58 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Sep 2017 05:05:45 +0000 (07:05 +0200)
commitfeb52e785e1f2a1f591d0771f722261352c97abe
tree25f99b3e7a2ea6aeb9870fd70995ebcc3fd38b8c
parent3c61cc0ec1c20f75f39fabe17ee2dd21dffe3435
mm/cma: make kmemleak ignore CMA regions

commit 620951e2745750de1482128615adc15b74ee37ed upstream.

kmemleak will add allocations as objects to a pool.  The memory allocated
for each object in this pool is periodically searched for pointers to
other allocated objects.  This only works for memory that is mapped into
the kernel's virtual address space, which happens not to be the case for
most CMA regions.

Furthermore, CMA regions are typically used to store data transferred to
or from a device and therefore don't contain pointers to other objects.

Without this, the kernel crashes on the first execution of the
scan_gray_list() because it tries to access highmem.  Perhaps a more
appropriate fix would be to reject any object that can't map to a kernel
virtual address?

[akpm@linux-foundation.org: add comment]
[akpm@linux-foundation.org: fix comment, per Catalin]
[sfr@canb.auug.org.au: include linux/io.h for phys_to_virt()]
Signed-off-by: Thierry Reding <treding@nvidia.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/cma.c