ipc/shm: Use the vma iterator for munmap calls
authorLiam Howlett <Liam.Howlett@oracle.com>
Mon, 14 Nov 2022 19:53:13 +0000 (14:53 -0500)
committerLiam Howlett <Liam.Howlett@oracle.com>
Mon, 14 Nov 2022 19:57:06 +0000 (14:57 -0500)
Pass through the vma iterator to do_vmi_munmap() to handle the iterator
state internally

Signed-off-by: Liam Howlett <Liam.Howlett@oracle.com>
ipc/shm.c

index 7d86f058fb861b8331faa0edd20fa890424561e7..b866a5ea2e787395c0217765820f56af73c97a7c 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1770,8 +1770,8 @@ long ksys_shmdt(char __user *shmaddr)
                         */
                        file = vma->vm_file;
                        size = i_size_read(file_inode(vma->vm_file));
-                       do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start, NULL);
-                       mas_pause(&vmi.mas);
+                       do_vmi_munmap(&vmi, mm, vma->vm_start,
+                             vma->vm_end - vma->vm_start, NULL, false);
                        /*
                         * We discovered the size of the shm segment, so
                         * break out of here and fall through to the next
@@ -1794,10 +1794,9 @@ 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_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start, NULL);
-                       mas_pause(&vmi.mas);
-               }
+                   (vma->vm_file == file))
+                       do_vmi_munmap(&vmi, mm, vma->vm_start,
+                             vma->vm_end - vma->vm_start, NULL, false);
 
                vma = vma_next(&vmi);
        }