public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH x86,mm]  cleanup: don't corrupt pgt_buf_end when we don't allocated from it
@ 2012-03-29  5:37 Lai Jiangshan
  0 siblings, 0 replies; only message in thread
From: Lai Jiangshan @ 2012-03-29  5:37 UTC (permalink / raw)
  To: x86, linux-kernel; +Cc: Ingo Molnar

when after_bootmem, alloc_low_page() allow page from get_zeroed_page(),
so we should not corrupt pgt_buf_end.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 436a030..cba66c6 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -317,7 +317,7 @@ void __init cleanup_highmap(void)
 
 static __ref void *alloc_low_page(unsigned long *phys)
 {
-	unsigned long pfn = pgt_buf_end++;
+	unsigned long pfn;
 	void *adr;
 
 	if (after_bootmem) {
@@ -327,6 +327,7 @@ static __ref void *alloc_low_page(unsigned long *phys)
 		return adr;
 	}
 
+	pfn = pgt_buf_end++;
 	if (pfn >= pgt_buf_top)
 		panic("alloc_low_page: ran out of memory");
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-29  5:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-29  5:37 [PATCH x86,mm] cleanup: don't corrupt pgt_buf_end when we don't allocated from it Lai Jiangshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox