[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210830141051.64090-7-linmiaohe@huawei.com>
Date: Mon, 30 Aug 2021 22:10:51 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: <akpm@...ux-foundation.org>
CC: <vbabka@...e.cz>, <sfr@...b.auug.org.au>, <peterz@...radead.org>,
<mgorman@...hsingularity.net>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <linmiaohe@...wei.com>
Subject: [PATCH 6/6] mm/page_alloc.c: avoid allocating highmem pages via alloc_pages_exact_nid()
Don't use with __GFP_HIGHMEM because page_address() cannot represent
highmem pages without kmap(). Newly allocated pages would leak as
page_address() will return NULL for highmem pages here. But It works
now because the only caller does not specify __GFP_HIGHMEM now.
Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d87b7e6e9e6b..858fd45ecaea 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5639,7 +5639,7 @@ void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask)
if (WARN_ON_ONCE(gfp_mask & __GFP_COMP))
gfp_mask &= ~__GFP_COMP;
- p = alloc_pages_node(nid, gfp_mask, order);
+ p = alloc_pages_node(nid, gfp_mask & ~__GFP_HIGHMEM, order);
if (!p)
return NULL;
return make_alloc_exact((unsigned long)page_address(p), order, size);
--
2.23.0
Powered by blists - more mailing lists