提交 c2e7e00b 编写于 作者: K Konstantin Khlebnikov 提交者: Linus Torvalds

mm/memory-failure: fix race with compound page split/merge

get_hwpoison_page() must recheck relation between head and tail pages.

n-horiguchi said: without this recheck, the race causes kernel to pin an
irrelevant page, and finally makes kernel crash for refcount mismatch.
Signed-off-by: NKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: NNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 b7341364
......@@ -888,7 +888,15 @@ int get_hwpoison_page(struct page *page)
}
}
return get_page_unless_zero(head);
if (get_page_unless_zero(head)) {
if (head == compound_head(page))
return 1;
pr_info("MCE: %#lx cannot catch tail\n", page_to_pfn(page));
put_page(head);
}
return 0;
}
EXPORT_SYMBOL_GPL(get_hwpoison_page);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册