]> git.baikalelectronics.ru Git - kernel.git/commit
mmap: fix copy_vma() failure path
authorLiam Howlett <liam.howlett@oracle.com>
Tue, 11 Oct 2022 20:36:51 +0000 (20:36 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 12 Oct 2022 22:56:46 +0000 (15:56 -0700)
commit50c7040c4ac414b95b2dcff5463d608ce81e7873
tree451e22c02a85744496fb4f755979693f2955d89f
parent18523e49011ddf8d2cb23961f30b3e56235fbf04
mmap: fix copy_vma() failure path

The anon vma was not unlinked and the file was not closed in the failure
path when the machine runs out of memory during the maple tree
modification.  This caused a memory leak of the anon vma chain and vma
since neither would be freed.

Link: https://lkml.kernel.org/r/20221011203621.1446507-1-Liam.Howlett@oracle.com
Fixes: 0abb9d7b6cdc ("mm: remove rb tree")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reported-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Tested-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c