summaryrefslogtreecommitdiffstats
path: root/mm/page-writeback.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2010-08-19 23:13:33 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-20 18:34:55 +0200
commitd5ed3a4af77b851b6271ad3d9abc4c57fa3ce0f5 (patch)
treef06894404e4af25051e8918bfd3fdac95974fc97 /mm/page-writeback.c
parentrevert "hwmon: f71882fg: add support for the Fintek F71808E" (diff)
downloadlinux-d5ed3a4af77b851b6271ad3d9abc4c57fa3ce0f5.tar.xz
linux-d5ed3a4af77b851b6271ad3d9abc4c57fa3ce0f5.zip
lib/radix-tree.c: fix overflow in radix_tree_range_tag_if_tagged()
When radix_tree_maxindex() is ~0UL, it can happen that scanning overflows index and tree traversal code goes astray reading memory until it hits unreadable memory. Check for overflow and exit in that case. Signed-off-by: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@lst.de> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r--mm/page-writeback.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 7262aacea8a2..c09ef5219cbe 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -836,7 +836,8 @@ void tag_pages_for_writeback(struct address_space *mapping,
spin_unlock_irq(&mapping->tree_lock);
WARN_ON_ONCE(tagged > WRITEBACK_TAG_BATCH);
cond_resched();
- } while (tagged >= WRITEBACK_TAG_BATCH);
+ /* We check 'start' to handle wrapping when end == ~0UL */
+ } while (tagged >= WRITEBACK_TAG_BATCH && start);
}
EXPORT_SYMBOL(tag_pages_for_writeback);