]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
fs/exec: Use vma_next() instead of linked list
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 4 Jan 2021 19:45:37 +0000 (14:45 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 24 Jun 2021 20:04:23 +0000 (16:04 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
fs/exec.c

index 3dfa1e6d237f529e80228885007c10882e074309..57e5e77cb5cebb54f6375e6c2d94d28dca8df6e6 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -678,6 +678,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
        unsigned long length = old_end - old_start;
        unsigned long new_start = old_start - shift;
        unsigned long new_end = old_end - shift;
+       struct vm_area_struct *next;
        struct mmu_gather tlb;
 
        BUG_ON(new_start > new_end);
@@ -705,12 +706,13 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
 
        lru_add_drain();
        tlb_gather_mmu(&tlb, mm);
+       next = vma_next(mm, vma);
        if (new_end > old_start) {
                /*
                 * when the old and new regions overlap clear from new_end.
                 */
                free_pgd_range(&tlb, new_end, old_end, new_end,
-                       vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
+                       next ? next->vm_start : USER_PGTABLES_CEILING);
        } else {
                /*
                 * otherwise, clean from old_start; this is done to not touch
@@ -719,7 +721,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
                 * for the others its just a little faster.
                 */
                free_pgd_range(&tlb, old_start, old_end, new_end,
-                       vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
+                       next ? next->vm_start : USER_PGTABLES_CEILING);
        }
        tlb_finish_mmu(&tlb);