Merge remote-tracking branch 'lsk/v3.10/topic/aosp-warnings' into linux-linaro-lsk...
[firefly-linux-kernel-4.4.55.git] / mm / mempolicy.c
index 74310017296ee02317b79a2c28b25ef303fc7720..28fb17845f7000168f26540b6bc7aa55388e9031 100644 (file)
@@ -728,11 +728,14 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
                        ((vmstart - vma->vm_start) >> PAGE_SHIFT);
                prev = vma_merge(mm, prev, vmstart, vmend, vma->vm_flags,
                                  vma->anon_vma, vma->vm_file, pgoff,
-                                 new_pol);
+                                 new_pol, vma_get_anon_name(vma));
                if (prev) {
                        vma = prev;
                        next = vma->vm_next;
-                       continue;
+                       if (mpol_equal(vma_policy(vma), new_pol))
+                               continue;
+                       /* vma_merge() joined vma && vma->next, case 8 */
+                       goto replace;
                }
                if (vma->vm_start != vmstart) {
                        err = split_vma(vma->vm_mm, vma, vmstart, 1);
@@ -744,6 +747,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
                        if (err)
                                goto out;
                }
+ replace:
                err = vma_replace_policy(vma, new_pol);
                if (err)
                        goto out;