Skip to content

Commit 1db43d3

Browse files
howlettakpm00
authored andcommitted
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/ Link: https://lkml.kernel.org/r/20221025161222.2634030-1-Liam.Howlett@oracle.com Fixes: 763ecb0 (mm: remove the vma linked list) Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Reported-by: "J. R. Okajima" <hooanon05g@gmail.com> Tested-by: "J. R. Okajima" <hooanon05g@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 5dc21f0 commit 1db43d3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

mm/mmap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2852,6 +2852,9 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
28522852
if (next->vm_flags != vma->vm_flags)
28532853
goto out;
28542854

2855+
if (start + size <= next->vm_end)
2856+
break;
2857+
28552858
prev = next;
28562859
}
28572860

0 commit comments

Comments
 (0)