vma.c (b7012d513f81959596a01083415597edb04cf509) vma.c (7e7b2370ed0551d2fa8e4bd6e4bbd603fef3cdcd)
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3/*
4 * VMA-specific functions.
5 */
6
7#include "vma_internal.h"
8#include "vma.h"

--- 655 unchanged lines hidden (view full) ---

664 }
665 }
666 if (vp->insert && vp->file)
667 uprobe_mmap(vp->insert);
668 validate_mm(mm);
669}
670
671/*
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3/*
4 * VMA-specific functions.
5 */
6
7#include "vma_internal.h"
8#include "vma.h"

--- 655 unchanged lines hidden (view full) ---

664 }
665 }
666 if (vp->insert && vp->file)
667 uprobe_mmap(vp->insert);
668 validate_mm(mm);
669}
670
671/*
672 * abort_munmap_vmas - Undo any munmap work and free resources
673 *
674 * Reattach any detached vmas and free up the maple tree used to track the vmas.
675 */
676static inline void abort_munmap_vmas(struct ma_state *mas_detach)
677{
678 struct vm_area_struct *vma;
679
680 mas_set(mas_detach, 0);
681 mas_for_each(mas_detach, vma, ULONG_MAX)
682 vma_mark_detached(vma, false);
683
684 __mt_destroy(mas_detach->tree);
685}
686
687/*
672 * do_vmi_align_munmap() - munmap the aligned region from @start to @end.
673 * @vmi: The vma iterator
674 * @vma: The starting vm_area_struct
675 * @mm: The mm_struct
676 * @start: The aligned start address to munmap.
677 * @end: The aligned end address to munmap.
678 * @uf: The userfaultfd list_head
679 * @unlock: Set to true to drop the mmap_lock. unlocking only happens on

--- 149 unchanged lines hidden (view full) ---

829 __mt_destroy(&mt_detach);
830 return 0;
831
832modify_vma_failed:
833clear_tree_failed:
834userfaultfd_error:
835munmap_gather_failed:
836end_split_failed:
688 * do_vmi_align_munmap() - munmap the aligned region from @start to @end.
689 * @vmi: The vma iterator
690 * @vma: The starting vm_area_struct
691 * @mm: The mm_struct
692 * @start: The aligned start address to munmap.
693 * @end: The aligned end address to munmap.
694 * @uf: The userfaultfd list_head
695 * @unlock: Set to true to drop the mmap_lock. unlocking only happens on

--- 149 unchanged lines hidden (view full) ---

845 __mt_destroy(&mt_detach);
846 return 0;
847
848modify_vma_failed:
849clear_tree_failed:
850userfaultfd_error:
851munmap_gather_failed:
852end_split_failed:
837 mas_set(&mas_detach, 0);
838 mas_for_each(&mas_detach, next, end)
839 vma_mark_detached(next, false);
840
841 __mt_destroy(&mt_detach);
853 abort_munmap_vmas(&mas_detach);
842start_split_failed:
843map_count_exceeded:
844 validate_mm(mm);
845 return error;
846}
847
848/*
849 * do_vmi_munmap() - munmap a given range.

--- 921 unchanged lines hidden ---
854start_split_failed:
855map_count_exceeded:
856 validate_mm(mm);
857 return error;
858}
859
860/*
861 * do_vmi_munmap() - munmap a given range.

--- 921 unchanged lines hidden ---