process/vm: fix lookup_process_memory_range (again)
That optimistically going left was a more serious bug than just last iteration, we could just pass by a match and continue down the tree if the match was not a leaf. Fix the actual algorithm issue Conflicts: kernel/process.c
This commit is contained in:
committed by
Balazs Gerofi
parent
67529f21ff
commit
d23939da8c
@ -1293,7 +1293,7 @@ struct vm_range *lookup_process_memory_range(
|
||||
int i;
|
||||
struct vm_range *range = NULL, *match = NULL;
|
||||
struct rb_root *root = &vm->vm_range_tree;
|
||||
struct rb_node *node = root->rb_node, *prev = NULL;
|
||||
struct rb_node *node = root->rb_node;
|
||||
|
||||
dkprintf("lookup_process_memory_range(%p,%lx,%lx)\n", vm, start, end);
|
||||
|
||||
@ -1312,7 +1312,6 @@ struct vm_range *lookup_process_memory_range(
|
||||
}
|
||||
|
||||
while (node) {
|
||||
prev = node;
|
||||
range = rb_entry(node, struct vm_range, vm_rb_node);
|
||||
if (end <= range->start) {
|
||||
node = node->rb_left;
|
||||
@ -1329,10 +1328,6 @@ struct vm_range *lookup_process_memory_range(
|
||||
}
|
||||
}
|
||||
|
||||
/* We optimistically try to go left, go back if we went too far */
|
||||
if (!node && range && start < range->end)
|
||||
node = prev;
|
||||
|
||||
if (match && end > match->start) {
|
||||
vm->range_cache_ind = (vm->range_cache_ind - 1 + VM_RANGE_CACHE_SIZE)
|
||||
% VM_RANGE_CACHE_SIZE;
|
||||
|
||||
Reference in New Issue
Block a user