mm: fix unaccount of memory on vma_link() failure
authorAnthony Yznaga <anthony.yznaga@oracle.com>
Wed, 30 Aug 2023 00:43:24 +0000 (17:43 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 4 Oct 2023 17:32:19 +0000 (10:32 -0700)
commitdd34d9fe3b427dea47f81443d022dbaec4339f7e
tree12c8578950ac34c1036c64360ad09d2efd12aabc
parent954652b9f33bb1892ea4448479d78779e4a8ae13
mm: fix unaccount of memory on vma_link() failure

Fix insert_vm_struct() so that only accounted memory is unaccounted if
vma_link() fails.

Link: https://lkml.kernel.org/r/20230830004324.16101-1-anthony.yznaga@oracle.com
Fixes: d4af56c5c7c6 ("mm: start tracking VMAs with maple tree")
Signed-off-by: Anthony Yznaga <anthony.yznaga@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c