[PATCH] mmap: fix loop when adjusting vma

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we have more work to do after one vma is removed, we have to reload @end in
case it is clobbered, then try again.

Thanks

Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
---

--- a/mm/mmap.c	Fri Nov 11 20:35:46 2011
+++ b/mm/mmap.c	Fri Nov 11 20:41:32 2011
@@ -490,6 +490,7 @@ __vma_unlink(struct mm_struct *mm, struc
 int vma_adjust(struct vm_area_struct *vma, unsigned long start,
 	unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert)
 {
+	unsigned long saved_end = end;
 	struct mm_struct *mm = vma->vm_mm;
 	struct vm_area_struct *next = vma->vm_next;
 	struct vm_area_struct *importer = NULL;
@@ -634,7 +635,14 @@ again:			remove_next = 1 + (end > next->
 		 */
 		if (remove_next == 2) {
 			next = vma->vm_next;
-			goto again;
+			if (next) {
+				/*
+				 * we have more work, reload @end in case
+				 * it is clobbered.
+				 */
+				end = saved_end;
+				goto again;
+			}
 		}
 	}

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]