]> www.infradead.org Git - users/hch/configfs.git/commitdiff
nommu: pass NULL argument to vma_iter_prealloc()
authorHajime Tazaki <thehajime@gmail.com>
Fri, 8 Nov 2024 22:28:34 +0000 (07:28 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 12 Nov 2024 01:20:23 +0000 (17:20 -0800)
When deleting a vma entry from a maple tree, it has to pass NULL to
vma_iter_prealloc() in order to calculate internal state of the tree, but
it passed a wrong argument.  As a result, nommu kernels crashed upon
accessing a vma iterator, such as acct_collect() reading the size of vma
entries after do_munmap().

This commit fixes this issue by passing a right argument to the
preallocation call.

Link: https://lkml.kernel.org/r/20241108222834.3625217-1-thehajime@gmail.com
Fixes: b5df09226450 ("mm: set up vma iterator for vma_iter_prealloc() calls")
Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/nommu.c

index e9b5f527ab5b429ff903e1351c3da6d28a7d392e..9cb6e99215e2b8e3821a6896e2d57aa42fb596cf 100644 (file)
@@ -573,7 +573,7 @@ static int delete_vma_from_mm(struct vm_area_struct *vma)
        VMA_ITERATOR(vmi, vma->vm_mm, vma->vm_start);
 
        vma_iter_config(&vmi, vma->vm_start, vma->vm_end);
-       if (vma_iter_prealloc(&vmi, vma)) {
+       if (vma_iter_prealloc(&vmi, NULL)) {
                pr_warn("Allocation of vma tree for process %d failed\n",
                       current->pid);
                return -ENOMEM;