After walking rb tree, if vma is determined, prev vma has to be determined based on vma; and rb_prev should be considered only if no vma determined. Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx> --- --- a/mm/mmap.c Fri Aug 3 07:38:10 2012 +++ b/mm/mmap.c Mon Aug 6 20:10:18 2012 @@ -385,9 +385,13 @@ find_vma_prepare(struct mm_struct *mm, u } } - *pprev = NULL; - if (rb_prev) - *pprev = rb_entry(rb_prev, struct vm_area_struct, vm_rb); + if (vma) { + *pprev = vma->vm_prev; + } else { + *pprev = NULL; + if (rb_prev) + *pprev = rb_entry(rb_prev, struct vm_area_struct, vm_rb); + } *rb_link = __rb_link; *rb_parent = __rb_parent; return vma; -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>