* [PATCH] mmap: Fix remap_file_pages() regression
@ 2022-10-25 16:12 Liam Howlett
2022-10-26 0:24 ` J. R. Okajima
0 siblings, 1 reply; 2+ messages in thread
From: Liam Howlett @ 2022-10-25 16:12 UTC (permalink / raw)
To: maple-tree, linux-mm, linux-kernel, Andrew Morton
Cc: Liam Howlett, J. R. Okajima
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@gmail.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmap: Fix remap_file_pages() regression
2022-10-25 16:12 [PATCH] mmap: Fix remap_file_pages() regression Liam Howlett
@ 2022-10-26 0:24 ` J. R. Okajima
0 siblings, 0 replies; 2+ messages in thread
From: J. R. Okajima @ 2022-10-26 0:24 UTC (permalink / raw)
To: Liam Howlett; +Cc: maple-tree, linux-mm, linux-kernel, Andrew Morton
Liam Howlett:
> 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.
Thaks, it passed the test.
J. R. Okajima
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-26 0:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 16:12 [PATCH] mmap: Fix remap_file_pages() regression Liam Howlett
2022-10-26 0:24 ` J. R. Okajima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).