Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753365AbcDRLnx (ORCPT ); Mon, 18 Apr 2016 07:43:53 -0400 Received: from forward-corp1o.mail.yandex.net ([37.140.190.172]:49088 "EHLO forward-corp1o.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbcDRLnw (ORCPT ); Mon, 18 Apr 2016 07:43:52 -0400 Authentication-Results: smtpcorp1m.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH] mm/memory-failure: fix race with compound page split/merge From: Konstantin Khlebnikov To: linux-mm@kvack.org, Naoya Horiguchi Cc: linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Date: Mon, 18 Apr 2016 14:43:45 +0300 Message-ID: <146097982568.15733.13924990169211134049.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 719 Lines: 28 Get_hwpoison_page() must recheck relation between head and tail pages. Signed-off-by: Konstantin Khlebnikov --- mm/memory-failure.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 78f5f2641b91..ca5acee53b7a 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -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);