[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20230110183042.1265916-1-Liam.Howlett@oracle.com>
Date: Tue, 10 Jan 2023 18:30:49 +0000
From: Liam Howlett <liam.howlett@...cle.com>
To: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>
CC: Liam Howlett <liam.howlett@...cle.com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: [PATCH v2] 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.
Cc: stable@...r.kernel.org
Fixes: 8220543df148 ("nommu: remove uses of VMA linked list")
Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
---
Changes since v1:
- Added 'Cc: stable@...r.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
Powered by blists - more mailing lists