Skip to content

Commit 80be727

Browse files
howlettakpm00
authored andcommitted
nommu: fix do_munmap() error path
When removing a VMA from the tree fails due to no memory, do not free the VMA since a reference still exists. Link: https://lkml.kernel.org/r/[email protected] Fixes: 8220543 ("nommu: remove uses of VMA linked list") Signed-off-by: Liam R. Howlett <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Yu Zhao <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 7f31cce commit 80be727

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/nommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,8 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, struct list
15091509
erase_whole_vma:
15101510
if (delete_vma_from_mm(vma))
15111511
ret = -ENOMEM;
1512-
delete_vma(mm, vma);
1512+
else
1513+
delete_vma(mm, vma);
15131514
return ret;
15141515
}
15151516

0 commit comments

Comments
 (0)