Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1185316

[PATCH v1 1/4] mm/memory-failure: unlock_page before put_page

Path csiph.com!aioe.org!news.cmpublishers.com!nntp.club.cc.cmu.edu!news.unit0.net!newsfeed.CARNet.hr!news.spin.it!bofh.it!news.nic.it!robomod
From Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Newsgroups linux.kernel
Subject [PATCH v1 1/4] mm/memory-failure: unlock_page before put_page
Date Thu, 16 Jul 2015 03:50:04 +0200
Message-ID <pMGte-pn-67@gated-at.bofh.it> (permalink)
References <pMGtc-pn-27@gated-at.bofh.it>
X-Original-To Andrew Morton <akpm@linux-foundation.org>
Thread-Topic [PATCH v1 1/4] mm/memory-failure: unlock_page before put_page
Thread-Index AQHQv2iZnzs1JVYhPU+ECaTs/7fBew==
Accept-Language ja-JP, en-US
Content-Language ja-JP
X-Originating-IP [10.128.101.23]
Content-Type text/plain; charset="iso-2022-jp"
Content-Transfer-Encoding 8BIT
MIME-Version 1.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 31
Organization linux.* mail to news gateway
X-Original-Cc Andi Kleen <andi@firstfloor.org>, Dean Nelson <dnelson@redhat.com>, "Tony Luck" <tony.luck@intel.com>, "Kirill A. Shutemov" <kirill@shutemov.name>, "Hugh Dickins" <hughd@google.com>, "linux-mm@kvack.org" <linux-mm@kvack.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "Naoya Horiguchi" <nao.horiguchi@gmail.com>
X-Original-Date Thu, 16 Jul 2015 01:41:56 +0000
X-Original-Message-ID <1437010894-10262-2-git-send-email-n-horiguchi@ah.jp.nec.com>
X-Original-References <1437010894-10262-1-git-send-email-n-horiguchi@ah.jp.nec.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1185316

Show key headers only | View raw


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 <n-horiguchi@ah.jp.nec.com>
---
 mm/memory-failure.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git v4.2-rc2.orig/mm/memory-failure.c v4.2-rc2/mm/memory-failure.c
index c53543d89282..04d677048af7 100644
--- v4.2-rc2.orig/mm/memory-failure.c
+++ v4.2-rc2/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/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v1 0/4] hwpoison: fixes on v4.2-rc2 Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-07-16 03:50 +0200
  [PATCH v1 2/4] mm/memory-failure: fix race in counting  num_poisoned_pages Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-07-16 03:50 +0200
  [PATCH v1 1/4] mm/memory-failure: unlock_page before put_page Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-07-16 03:50 +0200

csiph-web