From nobody Mon Jun 29 16:47:09 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFACBC47082 for ; Mon, 7 Feb 2022 14:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391305AbiBGOTp (ORCPT ); Mon, 7 Feb 2022 09:19:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390366AbiBGN5a (ORCPT ); Mon, 7 Feb 2022 08:57:30 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E7F5C03FEFF for ; Mon, 7 Feb 2022 05:57:14 -0800 (PST) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JsnjT218xzcclP; Mon, 7 Feb 2022 21:55:57 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 7 Feb 2022 21:56:56 +0800 From: Miaohe Lin To: CC: , , , , , Subject: [PATCH] mm/memory_hotplug: fix kfree() of bootmem memory Date: Mon, 7 Feb 2022 21:56:18 +0800 Message-ID: <20220207135618.17231-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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 *re= s) { if (!res) return; - release_resource(res); - kfree(res); + release_mem_region(res->start, resource_size(res)); } =20 static int check_pfn_span(unsigned long pfn, unsigned long nr_pages, --=20 2.23.0