]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm-mmap-vma_merge-set-mid-to-null-if-not-applicable-fix
authorVlastimil Babka <vbabka@suse.cz>
Tue, 28 Mar 2023 23:25:05 +0000 (16:25 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 28 Mar 2023 23:25:05 +0000 (16:25 -0700)
adjust/add comments as suggested by Lorenzo

Link: https://lkml.kernel.org/r/def43190-53f7-a607-d1b0-b657565f4288@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c

index 98533ce263524734d90dfc15631b36105ae76645..2b72ff3f757c2c7e4f5107744bfb8d1121a78cf2 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -861,8 +861,9 @@ can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags,
  *
  * The following mprotect cases have to be considered, where AAAA is
  * the area passed down from mprotect_fixup, never extending beyond one
- * vma, PPPPPP is the prev vma specified, NNNN is a vma that overlaps
- * the area AAAA and XXXXXX the next vma after AAAA:
+ * vma, PPPP is the previous vma, NNNN is a vma that starts at the same
+ * address as AAAA and is of the same or larger span, and XXXX the next
+ * vma after AAAA:
  *
  *     AAAA             AAAA                   AAAA
  *    PPPPPPXXXXXX    PPPPPPXXXXXX       PPPPPPNNNNNN
@@ -933,6 +934,7 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm,
        else
                next = mid;
 
+       /* In cases 1 - 4 there's no NNNN vma */
        if (mid && end <= mid->vm_start)
                mid = NULL;