... > > Just for clarity, tmp is used to ensure there isn't a hole in the range > we are iterating over. I don't particularly like how this was done, but > I tried (unsuccessfully) not to break it. > > It looks like I've missed the case where a merge succeeds and so tmp is > now out of sync with the iterator. > > I would change this tmp = prev->vm_end idea slightly and use the vma > iterator end location: > > tmp = vma_iter_end(&vmi); > > I'll send out a patch once I test this. The patch has been sent out and I've submitted my testing to LTP: https://github.com/linux-test-project/ltp/commit/3cbaaddf6f785d91aeb370beb75d0623f8c48624 The testcase is mprotect05 Thanks, Liam