nommu: fix split_vma() map_count error
authorLiam Howlett <liam.howlett@oracle.com>
Mon, 9 Jan 2023 20:58:20 +0000 (20:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:24:33 +0000 (07:24 +0100)
commite733121383c059cfa0db8f6bb7f7bc80f56ce7ef
treeaf34947e1b9eac9488b9edc7d80af8a0f72d78ba
parent6447569f4fce2c759e701bd45ea72ff802e817a0
nommu: fix split_vma() map_count error

commit fd9edbdbdcde6b489ce59f326755ef16a2ffadd7 upstream.

During the maple tree conversion of nommu, an error in counting the VMAs
was introduced by counting the existing VMA again.  The counting used to
be decremented by one and incremented by two, but now it only increments
by two.  Fix the counting error by moving the increment outside the
setup_vma_to_mm() function to the callers.

Link: https://lkml.kernel.org/r/20230109205809.956325-1-Liam.Howlett@oracle.com
Fixes: 8220543df148 ("nommu: remove uses of VMA linked list")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yu Zhao <yuzhao@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/nommu.c