aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2011-03-17 19:16:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 19:31:13 -0400
commitef2b4b95a63a1d23958dcb99eb2c6898eddc87d0 (patch)
tree0a22745dba03926768552aa3006b166995e5342d /mm/page_alloc.c
parent7b7adc4a016a1decb806eb71ecab98721fa7f146 (diff)
mm: PageBuddy and mapcount robustness
Change the _mapcount value indicating PageBuddy from -2 to -128 for more robusteness against page_mapcount() undeflows. Use reset_page_mapcount instead of __ClearPageBuddy in bad_page to ignore the previous retval of PageBuddy(). Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Reported-by: Hugh Dickins <hughd@google.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bd7625676a64..7945247b1e53 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -286,7 +286,7 @@ static void bad_page(struct page *page)
286 286
287 /* Don't complain about poisoned pages */ 287 /* Don't complain about poisoned pages */
288 if (PageHWPoison(page)) { 288 if (PageHWPoison(page)) {
289 __ClearPageBuddy(page); 289 reset_page_mapcount(page); /* remove PageBuddy */
290 return; 290 return;
291 } 291 }
292 292
@@ -317,7 +317,7 @@ static void bad_page(struct page *page)
317 dump_stack(); 317 dump_stack();
318out: 318out:
319 /* Leave bad fields for debug, except PageBuddy could make trouble */ 319 /* Leave bad fields for debug, except PageBuddy could make trouble */
320 __ClearPageBuddy(page); 320 reset_page_mapcount(page); /* remove PageBuddy */
321 add_taint(TAINT_BAD_PAGE); 321 add_taint(TAINT_BAD_PAGE);
322} 322}
323 323