diff mbox series

[v1,1/2] mm/cma.c: Make kmemleak aware of all CMA regions

Message ID 20230109221624.592315-2-isaacmanjarres@google.com (mailing list archive)
State New
Headers show
Series Fixes for kmemleak tracking with CMA regions | expand

Commit Message

Isaac Manjarres Jan. 9, 2023, 10:16 p.m. UTC
Currently, kmemleak tracks CMA regions that are specified through the
devicetree. However, if the global CMA region is specified through
the commandline, kmemleak will be unaware of the CMA region because
kmemleak_alloc_phys() is not invoked after memblock_reserve(). Add
the missing call to kmemleak_alloc_phys() so that all CMA regions are
tracked by kmemleak before they are freed to the page allocator in
cma_activate_area().

Cc: stable@vger.kernel.org
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
---
 mm/cma.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/mm/cma.c b/mm/cma.c
index 4a978e09547a..674b7fdd563e 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -318,6 +318,8 @@  int __init cma_declare_contiguous_nid(phys_addr_t base,
 			ret = -EBUSY;
 			goto err;
 		}
+
+		kmemleak_alloc_phys(base, size, 0);
 	} else {
 		phys_addr_t addr = 0;