2004-06-22 21:02:53

by Chen, Kenneth W

[permalink] [raw]
Subject: Bug fix in mm/hugetlb.c - use safe iterater

With list poisoning on by default from linux-2.6.7, it's easier
than ever to trigger the bug in try_to_free_low(). It ought to
use the safe version of list iterater.

Signed-off-by: Ken Chen <[email protected]>


diff -Nurp linux-2.6.7.orig/mm/hugetlb.c linux-2.6.7/mm/hugetlb.c
--- linux-2.6.7.orig/mm/hugetlb.c 2004-06-15 22:19:37.000000000 -0700
+++ linux-2.6.7/mm/hugetlb.c 2004-06-22 13:45:11.000000000 -0700
@@ -134,8 +134,8 @@ static int try_to_free_low(unsigned long
{
int i;
for (i = 0; i < MAX_NUMNODES; ++i) {
- struct page *page;
- list_for_each_entry(page, &hugepage_freelists[i], lru) {
+ struct page *page, *next;
+ list_for_each_entry_safe(page, next, &hugepage_freelists[i], lru) {
if (PageHighMem(page))
continue;
list_del(&page->lru);