mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Nick Piggin <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
f2e41e9103
commit
d5ed3a4af7
2 changed files with 6 additions and 2 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue