From a6aa62a0909b9ccb1f8b0d2653920ba071037972 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Tue, 20 Jul 2010 13:24:25 -0700 Subject: 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 --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3