[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221025161222.2634030-1-Liam.Howlett@oracle.com>
Date: Tue, 25 Oct 2022 16:12:49 +0000
From: Liam Howlett <liam.howlett@...cle.com>
To: "maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
CC: Liam Howlett <liam.howlett@...cle.com>,
"J. R. Okajima" <hooanon05g@...il.com>
Subject: [PATCH] mmap: Fix remap_file_pages() regression
When using the VMA iterator, the final execution will set the variable
'next' to NULL which causes the function to fail out. Restore the break
in the loop to exit the VMA iterator early without clearing NULL fixes
the issue.
Link: https://lore.kernel.org/lkml/29344.1666681759@jrobl/
Fixes: 763ecb035029 (mm: remove the vma linked list)
Reported-by: "J. R. Okajima" <hooanon05g@...il.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
---
mm/mmap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/mmap.c b/mm/mmap.c
index 22010e13f1a1..ff670e88b6d0 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2851,6 +2851,9 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
if (next->vm_flags != vma->vm_flags)
goto out;
+ if (start + size <= next->vm_end)
+ break;
+
prev = next;
}
--
2.35.1
Powered by blists - more mailing lists