]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
alloc_tag: mark pages reserved during CMA activation as not tagged
authorSuren Baghdasaryan <surenb@google.com>
Tue, 13 Aug 2024 15:07:57 +0000 (08:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Aug 2024 15:35:41 +0000 (17:35 +0200)
commit 766c163c2068b45330664fb67df67268e588a22d upstream.

During CMA activation, pages in CMA area are prepared and then freed
without being allocated.  This triggers warnings when memory allocation
debug config (CONFIG_MEM_ALLOC_PROFILING_DEBUG) is enabled.  Fix this by
marking these pages not tagged before freeing them.

Link: https://lkml.kernel.org/r/20240813150758.855881-2-surenb@google.com
Fixes: d224eb0287fb ("codetag: debug: mark codetags for reserved pages as empty")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Sourav Panda <souravpanda@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: <stable@vger.kernel.org> [6.10]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/mm_init.c

index 3ec04933f7fd8a192d3c2681a3803ea167a39949..13eb7cd58d9e21cee6d3a43d2574fc7b7f1604ad 100644 (file)
@@ -2293,6 +2293,8 @@ void __init init_cma_reserved_pageblock(struct page *page)
 
        set_pageblock_migratetype(page, MIGRATE_CMA);
        set_page_refcounted(page);
+       /* pages were reserved and not allocated */
+       clear_page_tag_ref(page);
        __free_pages(page, pageblock_order);
 
        adjust_managed_page_count(page, pageblock_nr_pages);