mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
radix-tree: fix radix_tree_create for sibling entries
If the radix tree user attempted to insert a colliding entry with an existing multiorder entry, then radix_tree_create() could encounter a sibling entry when walking down the tree to look for a slot. Use radix_tree_descend() to fix the problem, and add a test-case to make sure the problem doesn't come back in future. Signed-off-by: Matthew Wilcox <[email protected]> Reviewed-by: Ross Zwisler <[email protected]> Cc: Konstantin Khlebnikov <[email protected]> Cc: Kirill Shutemov <[email protected]> Cc: Jan Kara <[email protected]> Cc: Neil Brown <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
0fc9b8ca2b
commit
8a14f4d832
2 changed files with 7 additions and 2 deletions
|
|
@ -548,9 +548,9 @@ int __radix_tree_create(struct radix_tree_root *root, unsigned long index,
|
|||
/* Go a level down */
|
||||
height--;
|
||||
shift -= RADIX_TREE_MAP_SHIFT;
|
||||
offset = (index >> shift) & RADIX_TREE_MAP_MASK;
|
||||
node = indirect_to_ptr(slot);
|
||||
slot = node->slots[offset];
|
||||
offset = (index >> shift) & RADIX_TREE_MAP_MASK;
|
||||
offset = radix_tree_descend(node, &slot, offset);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RADIX_TREE_MULTIORDER
|
||||
|
|
|
|||
Loading…
Reference in a new issue