Skip to content

Commit deb521c

Browse files
committed
remap_file_pages: correctly handle the case of a NULL vm_ops pointer
In commit 0b173bc ("mm: kill vma flag VM_CAN_NONLINEAR") we replaced the VM_CAN_NONLINEAR test with checking whether the mapping has a '->remap_pages()' vm operation, but there is no guarantee that there it even has a vm_ops pointer at all. Add the appropriate test for NULL vm_ops. Reported-by: Sasha Levin <[email protected]> Cc: Konstantin Khlebnikov <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 17dbe27 commit deb521c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/fremap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
169169
if (vma->vm_private_data && !(vma->vm_flags & VM_NONLINEAR))
170170
goto out;
171171

172-
if (!vma->vm_ops->remap_pages)
172+
if (!vma->vm_ops || !vma->vm_ops->remap_pages)
173173
goto out;
174174

175175
if (start < vma->vm_start || start + size > vma->vm_end)

0 commit comments

Comments
 (0)