diff options
author | Minchan Kim <minchan.kim@gmail.com> | 2011-02-01 18:52:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-02-02 19:03:18 -0500 |
commit | 48db54ee2f41e8ae2faf330b55db34a9fffb5b3c (patch) | |
tree | 5cdf936bf6996e379784e0b75b982a364f437368 /mm/memory-failure.c | |
parent | 57fc4a5ee322cde96c33f101d3c2d3b79011c05c (diff) |
mm/migration: fix page corruption during hugepage migration
If migrate_huge_page by memory-failure fails , it calls put_page in itself
to decrease page reference and caller of migrate_huge_page also calls
putback_lru_pages. It can do double free of page so it can make page
corruption on page holder.
In addtion, clean of pages on caller is consistent behavior with
migrate_pages by cf608ac19c ("mm: compaction: fix COMPACTPAGEFAILED
counting").
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory-failure.c')
-rw-r--r-- | mm/memory-failure.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 75398b0bfede..237aaa488f4e 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
@@ -1295,7 +1295,10 @@ static int soft_offline_huge_page(struct page *page, int flags) | |||
1295 | ret = migrate_huge_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, 0, | 1295 | ret = migrate_huge_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, 0, |
1296 | true); | 1296 | true); |
1297 | if (ret) { | 1297 | if (ret) { |
1298 | putback_lru_pages(&pagelist); | 1298 | struct page *page1, *page2; |
1299 | list_for_each_entry_safe(page1, page2, &pagelist, lru) | ||
1300 | put_page(page1); | ||
1301 | |||
1299 | pr_debug("soft offline: %#lx: migration failed %d, type %lx\n", | 1302 | pr_debug("soft offline: %#lx: migration failed %d, type %lx\n", |
1300 | pfn, ret, page->flags); | 1303 | pfn, ret, page->flags); |
1301 | if (ret > 0) | 1304 | if (ret > 0) |