From: Nick Piggin <npiggin@suse.de>
Date: Tue, 20 Jul 2010 20:24:25 +0000 (-0700)
Subject: mm/vmscan.c: fix mapping use after free
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a6aa62a0909b9ccb1f8b0d2653920ba071037972;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

mm/vmscan.c: fix mapping use after free

We need lock_page_nosync() here because we have no reference to the
mapping when taking the page lock.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
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>
---

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 199fa436c0dd..b94fe1b3da43 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -298,7 +298,7 @@ static int may_write_to_queue(struct backing_dev_info *bdi)
 static void handle_write_error(struct address_space *mapping,
 				struct page *page, int error)
 {
-	lock_page(page);
+	lock_page_nosync(page);
 	if (page_mapping(page) == mapping)
 		mapping_set_error(mapping, error);
 	unlock_page(page);