mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
ipc/shm: introduce new do_vma_munmap() to munmap
The shm already has the vma iterator in position for a write. do_vmi_munmap() searches for the correct position and aligns the write, so it is not the right function to use in this case. The shm VMA tree modification is similar to the brk munmap situation, the vma iterator is in position and the VMA is already known. This patch generalizes the brk munmap function do_brk_munmap() to be used for any other callers with the vma iterator already in position to munmap a VMA. Link: https://lkml.kernel.org/r/20230126212049.980501-1-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Reported-by: Sven Schnelle <svens@linux.ibm.com> Link: https://lore.kernel.org/linux-mm/yt9dh6wec21a.fsf@linux.ibm.com/ Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
d60beb1f69
commit
27b2670112
11
ipc/shm.c
11
ipc/shm.c
@@ -1786,8 +1786,8 @@ long ksys_shmdt(char __user *shmaddr)
|
||||
*/
|
||||
file = vma->vm_file;
|
||||
size = i_size_read(file_inode(vma->vm_file));
|
||||
do_vmi_munmap(&vmi, mm, vma->vm_start,
|
||||
vma->vm_end - vma->vm_start, NULL, false);
|
||||
do_vma_munmap(&vmi, vma, vma->vm_start, vma->vm_end,
|
||||
NULL, false);
|
||||
/*
|
||||
* We discovered the size of the shm segment, so
|
||||
* break out of here and fall through to the next
|
||||
@@ -1810,9 +1810,10 @@ long ksys_shmdt(char __user *shmaddr)
|
||||
/* finding a matching vma now does not alter retval */
|
||||
if ((vma->vm_ops == &shm_vm_ops) &&
|
||||
((vma->vm_start - addr)/PAGE_SIZE == vma->vm_pgoff) &&
|
||||
(vma->vm_file == file))
|
||||
do_vmi_munmap(&vmi, mm, vma->vm_start,
|
||||
vma->vm_end - vma->vm_start, NULL, false);
|
||||
(vma->vm_file == file)) {
|
||||
do_vma_munmap(&vmi, vma, vma->vm_start, vma->vm_end,
|
||||
NULL, false);
|
||||
}
|
||||
|
||||
vma = vma_next(&vmi);
|
||||
}
|
||||
|
Reference in New Issue
Block a user