summaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2010-07-20 22:24:25 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2010-07-21 01:25:40 +0200
commita6aa62a0909b9ccb1f8b0d2653920ba071037972 (patch)
tree2df66e9a20cdb8fac10a1979c6b678e98ee67f0a /mm/vmscan.c
parentipc/sem.c: bugfix for semop() not reporting successful operation (diff)
downloadlinux-a6aa62a0909b9ccb1f8b0d2653920ba071037972.tar.xz
linux-a6aa62a0909b9ccb1f8b0d2653920ba071037972.zip
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>
Diffstat (limited to '')
-rw-r--r--mm/vmscan.c2
1 files changed, 1 insertions, 1 deletions
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);