diff options
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1551,11 +1551,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr, | |||
1551 | 1551 | ||
1552 | /* Clear old maps */ | 1552 | /* Clear old maps */ |
1553 | error = -ENOMEM; | 1553 | error = -ENOMEM; |
1554 | munmap_back: | 1554 | while (find_vma_links(mm, addr, addr + len, &prev, &rb_link, |
1555 | if (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) { | 1555 | &rb_parent)) { |
1556 | if (do_munmap(mm, addr, len)) | 1556 | if (do_munmap(mm, addr, len)) |
1557 | return -ENOMEM; | 1557 | return -ENOMEM; |
1558 | goto munmap_back; | ||
1559 | } | 1558 | } |
1560 | 1559 | ||
1561 | /* | 1560 | /* |
@@ -1571,7 +1570,8 @@ munmap_back: | |||
1571 | /* | 1570 | /* |
1572 | * Can we just expand an old mapping? | 1571 | * Can we just expand an old mapping? |
1573 | */ | 1572 | */ |
1574 | vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff, NULL); | 1573 | vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff, |
1574 | NULL); | ||
1575 | if (vma) | 1575 | if (vma) |
1576 | goto out; | 1576 | goto out; |
1577 | 1577 | ||
@@ -2739,11 +2739,10 @@ static unsigned long do_brk(unsigned long addr, unsigned long len) | |||
2739 | /* | 2739 | /* |
2740 | * Clear old maps. this also does some error checking for us | 2740 | * Clear old maps. this also does some error checking for us |
2741 | */ | 2741 | */ |
2742 | munmap_back: | 2742 | while (find_vma_links(mm, addr, addr + len, &prev, &rb_link, |
2743 | if (find_vma_links(mm, addr, addr + len, &prev, &rb_link, &rb_parent)) { | 2743 | &rb_parent)) { |
2744 | if (do_munmap(mm, addr, len)) | 2744 | if (do_munmap(mm, addr, len)) |
2745 | return -ENOMEM; | 2745 | return -ENOMEM; |
2746 | goto munmap_back; | ||
2747 | } | 2746 | } |
2748 | 2747 | ||
2749 | /* Check against address space limits *after* clearing old maps... */ | 2748 | /* Check against address space limits *after* clearing old maps... */ |