From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>
Cc: <isimatu.yasuaki@jp.fujitsu.com>, <toshi.kani@hp.com>,
<david@redhat.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com>
Subject: [PATCH] mm/memory_hotplug: fix kfree() of bootmem memory
Date: Mon, 7 Feb 2022 21:56:18 +0800 [thread overview]
Message-ID: <20220207135618.17231-1-linmiaohe@huawei.com> (raw)
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
next reply other threads:[~2022-02-07 13:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 13:56 Miaohe Lin [this message]
2022-02-07 14:33 ` [PATCH] mm/memory_hotplug: fix kfree() of bootmem memory David Hildenbrand
2022-02-08 1:59 ` Miaohe Lin
2022-02-08 9:19 ` David Hildenbrand
2022-02-08 11:20 ` Miaohe Lin
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=20220207135618.17231-1-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=toshi.kani@hp.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;
as well as URLs for NNTP newsgroup(s).