linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/memory_hotplug: fix kfree() of bootmem memory
@ 2022-02-07 13:56 Miaohe Lin
  2022-02-07 14:33 ` David Hildenbrand
  0 siblings, 1 reply; 5+ messages in thread
From: Miaohe Lin @ 2022-02-07 13:56 UTC (permalink / raw)
  To: akpm
  Cc: isimatu.yasuaki, toshi.kani, david, linux-mm, linux-kernel, linmiaohe

We can't use kfree() to release the resource as it might come from bootmem.
Use release_mem_region() instead.

Fixes: ebff7d8f270d ("mem hotunplug: fix kfree() of bootmem memory")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/memory_hotplug.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 7dc7e12302db..dc570772b4b1 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -216,8 +216,7 @@ static void release_memory_resource(struct resource *res)
 {
 	if (!res)
 		return;
-	release_resource(res);
-	kfree(res);
+	release_mem_region(res->start, resource_size(res));
 }
 
 static int check_pfn_span(unsigned long pfn, unsigned long nr_pages,
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-08 11:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07 13:56 [PATCH] mm/memory_hotplug: fix kfree() of bootmem memory Miaohe Lin
2022-02-07 14:33 ` David Hildenbrand
2022-02-08  1:59   ` Miaohe Lin
2022-02-08  9:19     ` David Hildenbrand
2022-02-08 11:20       ` Miaohe Lin

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).