提交 58927533 编写于 作者: R Rik van Riel 提交者: Linus Torvalds

mmap: check ->vm_ops before dereferencing

Check whether the VMA has a vm_ops before calling close, just
like we check vm_ops before calling open a few dozen lines
higher up in the function.
Signed-off-by: NRik van Riel <riel@redhat.com>
Reported-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 a231a1f2
......@@ -1977,7 +1977,8 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
return 0;
/* Clean everything up if vma_adjust failed. */
new->vm_ops->close(new);
if (new->vm_ops && new->vm_ops->close)
new->vm_ops->close(new);
if (new->vm_file) {
if (vma->vm_flags & VM_EXECUTABLE)
removed_exe_file_vma(mm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册