Skip to contentSkip to conversation

mmap: Fix remap_file_pages() regression

PATCH Applied Liam Howlett 2 participants 2 messages Oct 25, 2022 – Oct 26, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 mm/mmap.c | 3 +++
 1 file changed, 3 insertions(+)
mm/mmap.c +3 -0
index 22010e13f1a1..ff670e88b6d0 100644
@@ -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;
 		}
 
Signature · 1 line
2.35.1
#1 lore raw

Liam Howlett:

Quoted 4 lines

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