Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

remap_file_pages: correctly handle the case of a NULL vm_ops pointer

In commit 0b173bc4daa8 ("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 <levinsasha928@gmail.com>
Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+1 -1
+1 -1
mm/fremap.c
··· 169 169 if (vma->vm_private_data && !(vma->vm_flags & VM_NONLINEAR)) 170 170 goto out; 171 171 172 - if (!vma->vm_ops->remap_pages) 172 + if (!vma->vm_ops || !vma->vm_ops->remap_pages) 173 173 goto out; 174 174 175 175 if (start < vma->vm_start || start + size > vma->vm_end)