aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2006-09-26 02:31:23 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:48:48 -0400
commit28e4d965e6131ace1e813e93aebca89ac6b82dc1 (patch)
tree6c98aa227c5cfdc9fb51ddf53c4497127beb3ca1 /mm/vmscan.c
parentbfa5bf6d6446f0028187a727f792fbc7934228ad (diff)
[PATCH] mm: remove_mapping() safeness
Some users of remove_mapping had been unsafe. Modify the remove_mapping precondition to ensure the caller has locked the page and obtained the correct mapping. Modify callers to ensure the mapping is the correct one. [hugh@veritas.com: swapper_space fix] Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 41a3da3d6ccc..16180587fd7d 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -377,8 +377,8 @@ static pageout_t pageout(struct page *page, struct address_space *mapping)
377 377
378int remove_mapping(struct address_space *mapping, struct page *page) 378int remove_mapping(struct address_space *mapping, struct page *page)
379{ 379{
380 if (!mapping) 380 BUG_ON(!PageLocked(page));
381 return 0; /* truncate got there first */ 381 BUG_ON(mapping != page_mapping(page));
382 382
383 write_lock_irq(&mapping->tree_lock); 383 write_lock_irq(&mapping->tree_lock);
384 384
@@ -547,7 +547,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
547 goto free_it; 547 goto free_it;
548 } 548 }
549 549
550 if (!remove_mapping(mapping, page)) 550 if (!mapping || !remove_mapping(mapping, page))
551 goto keep_locked; 551 goto keep_locked;
552 552
553free_it: 553free_it: