mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
mm/vma: add limits to unmap_region() for vmas
Add a limit to the vma search instead of using the start and end of the one passed in. No functional changes intended. Link: https://lkml.kernel.org/r/20260121164946.2093480-5-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Reviewed-by: Pedro Falcato <pfalcato@suse.de> Reviewed-by: Suren Baghdasaryan <surenb@google.com> Cc: Baoquan He <bhe@redhat.com> Cc: Barry Song <baohua@kernel.org> Cc: Chris Li <chrisl@kernel.org> Cc: David Hildenbrand <david@kernel.org> Cc: Jann Horn <jannh@google.com> Cc: Kairui Song <kasong@tencent.com> Cc: Kemeng Shi <shikemeng@huaweicloud.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Nhat Pham <nphamcs@gmail.com> Cc: SeongJae Park <sj@kernel.org> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
d6d13e2ad8
commit
23bd03a9a2
6
mm/vma.c
6
mm/vma.c
@@ -473,6 +473,7 @@ void remove_vma(struct vm_area_struct *vma)
|
|||||||
* Called with the mm semaphore held.
|
* Called with the mm semaphore held.
|
||||||
*/
|
*/
|
||||||
void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
|
void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
|
||||||
|
unsigned long vma_start, unsigned long vma_end,
|
||||||
struct vm_area_struct *prev, struct vm_area_struct *next)
|
struct vm_area_struct *prev, struct vm_area_struct *next)
|
||||||
{
|
{
|
||||||
struct mm_struct *mm = vma->vm_mm;
|
struct mm_struct *mm = vma->vm_mm;
|
||||||
@@ -480,7 +481,7 @@ void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
|
|||||||
|
|
||||||
tlb_gather_mmu(&tlb, mm);
|
tlb_gather_mmu(&tlb, mm);
|
||||||
update_hiwater_rss(mm);
|
update_hiwater_rss(mm);
|
||||||
unmap_vmas(&tlb, mas, vma, vma->vm_start, vma->vm_end, vma->vm_end);
|
unmap_vmas(&tlb, mas, vma, vma_start, vma_end, vma_end);
|
||||||
mas_set(mas, vma->vm_end);
|
mas_set(mas, vma->vm_end);
|
||||||
free_pgtables(&tlb, mas, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
|
free_pgtables(&tlb, mas, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
|
||||||
next ? next->vm_start : USER_PGTABLES_CEILING,
|
next ? next->vm_start : USER_PGTABLES_CEILING,
|
||||||
@@ -2466,7 +2467,8 @@ static int __mmap_new_file_vma(struct mmap_state *map,
|
|||||||
|
|
||||||
vma_iter_set(vmi, vma->vm_end);
|
vma_iter_set(vmi, vma->vm_end);
|
||||||
/* Undo any partial mapping done by a device driver. */
|
/* Undo any partial mapping done by a device driver. */
|
||||||
unmap_region(&vmi->mas, vma, map->prev, map->next);
|
unmap_region(&vmi->mas, vma, vma->vm_start, vma->vm_end,
|
||||||
|
map->prev, map->next);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|||||||
1
mm/vma.h
1
mm/vma.h
@@ -264,6 +264,7 @@ int do_vmi_munmap(struct vma_iterator *vmi, struct mm_struct *mm,
|
|||||||
void remove_vma(struct vm_area_struct *vma);
|
void remove_vma(struct vm_area_struct *vma);
|
||||||
|
|
||||||
void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
|
void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
|
||||||
|
unsigned long vma_start, unsigned long vma_end,
|
||||||
struct vm_area_struct *prev, struct vm_area_struct *next);
|
struct vm_area_struct *prev, struct vm_area_struct *next);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user