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/[email protected] Fixes: 763ecb0 (mm: remove the vma linked list) Signed-off-by: Liam R. Howlett <[email protected]> Reported-by: "J. R. Okajima" <[email protected]> Tested-by: "J. R. Okajima" <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 5dc21f0 commit 1db43d3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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)