linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] nommu: Fix do_munmap() error path
@ 2023-01-10 18:30 Liam Howlett
  0 siblings, 0 replies; only message in thread
From: Liam Howlett @ 2023-01-10 18:30 UTC (permalink / raw)
  To: linux-mm, linux-kernel, Andrew Morton, maple-tree; +Cc: Liam Howlett, stable

When removing a VMA from the tree fails due to no memory, do not free
the VMA since a reference still exists.

Cc: stable@vger.kernel.org
Fixes: 8220543df148 ("nommu: remove uses of VMA linked list")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---

Changes since v1:
 - Added 'Cc: stable@vger.kernel.org' to commit message

 mm/nommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index c8252f01d5db..844af5be7640 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1509,7 +1509,8 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, struct list
 erase_whole_vma:
 	if (delete_vma_from_mm(vma))
 		ret = -ENOMEM;
-	delete_vma(mm, vma);
+	else
+		delete_vma(mm, vma);
 	return ret;
 }
 
-- 
2.35.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-10 18:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 18:30 [PATCH v2] nommu: Fix do_munmap() error path Liam Howlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox