[PATCH] free_page(0) freed pagenr 0x40000

From: Hugh Dickins (hugh@veritas.com)
Date: Thu Jan 11 2001 - 17:45:30 EST


sys_mount(), and probably others, calls free_page(0) when
no page was got. free_pages() allows for this explicitly if
CONFIG_DISCONTIGMEM, and _appears_ to allow for it generally
by testing VALID_PAGE() - but that test is inadequate, if
over 1GB of memory then pagenr 0x40000 can be wrongly freed
(in i386 case). Complicate the test, for what? or simply...

--- linux-2.4.1-pre2/mm/page_alloc.c Thu Jan 11 13:44:43 2001
+++ linux/mm/page_alloc.c Thu Jan 11 21:41:39 2001
@@ -542,14 +542,8 @@
 
 void free_pages(unsigned long addr, unsigned long order)
 {
- struct page *fpage;
-
-#ifdef CONFIG_DISCONTIGMEM
- if (addr == 0) return;
-#endif
- fpage = virt_to_page(addr);
- if (VALID_PAGE(fpage))
- __free_pages(fpage, order);
+ if (addr != 0)
+ __free_pages(virt_to_page(addr), order);
 }
 
 /*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 15 2001 - 21:00:32 EST