[PATCH] free_page(0) freed pagenr 0x40000

2001-01-11 Thread Hugh Dickins

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 0x4 can be wrongly freed
(in i386 case).  Complicate the test, for what? or simply...

--- linux-2.4.1-pre2/mm/page_alloc.cThu 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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



[PATCH] free_page(0) freed pagenr 0x40000

2001-01-11 Thread Hugh Dickins

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 0x4 can be wrongly freed
(in i386 case).  Complicate the test, for what? or simply...

--- linux-2.4.1-pre2/mm/page_alloc.cThu 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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/