Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752509AbbGaGtU (ORCPT ); Fri, 31 Jul 2015 02:49:20 -0400 Received: from TYO202.gate.nec.co.jp ([210.143.35.52]:44833 "EHLO tyo202.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbbGaGtT convert rfc822-to-8bit (ORCPT ); Fri, 31 Jul 2015 02:49:19 -0400 From: Naoya Horiguchi To: Andrew Morton CC: Andi Kleen , Dean Nelson , "Tony Luck" , "Kirill A. Shutemov" , "Hugh Dickins" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "Naoya Horiguchi" , Naoya Horiguchi Subject: [PATCH v2 1/5] mm/memory-failure: unlock_page before put_page Thread-Topic: [PATCH v2 1/5] mm/memory-failure: unlock_page before put_page Thread-Index: AQHQy1yXV7/XTWw69UmIBYlseNGdpg== Date: Fri, 31 Jul 2015 06:46:12 +0000 Message-ID: <1438325105-10059-2-git-send-email-n-horiguchi@ah.jp.nec.com> References: <1438325105-10059-1-git-send-email-n-horiguchi@ah.jp.nec.com> In-Reply-To: <1438325105-10059-1-git-send-email-n-horiguchi@ah.jp.nec.com> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.128.101.6] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1088 Lines: 31 In "just unpoisoned" path, we do put_page and then unlock_page, which is a wrong order and causes "freeing locked page" bug. So let's fix it. Signed-off-by: Naoya Horiguchi --- mm/memory-failure.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git v4.2-rc4.orig/mm/memory-failure.c v4.2-rc4/mm/memory-failure.c index c53543d89282..04d677048af7 100644 --- v4.2-rc4.orig/mm/memory-failure.c +++ v4.2-rc4/mm/memory-failure.c @@ -1209,9 +1209,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags) if (!PageHWPoison(p)) { printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn); atomic_long_sub(nr_pages, &num_poisoned_pages); + unlock_page(hpage); put_page(hpage); - res = 0; - goto out; + return 0; } if (hwpoison_filter(p)) { if (TestClearPageHWPoison(p)) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/