From: Nick Piggin Date: Tue, 20 Jul 2010 20:24:25 +0000 (-0700) Subject: mm/vmscan.c: fix mapping use after free X-Git-Tag: v2.6.35-rc6~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6aa62a0909b9ccb1f8b0d2653920ba071037972;p=platform%2Fkernel%2Flinux-stable.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 Reviewed-by: Johannes Weiner Cc: Mel Gorman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/vmscan.c b/mm/vmscan.c index 199fa43..b94fe1b 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);