From: Rik van Riel Date: Mon, 26 Apr 2010 16:33:03 +0000 (-0400) Subject: mmap: check ->vm_ops before dereferencing X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5892753383090a3eddf0e1b043c95e3b2c7feda5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: Rik van Riel Reported-by: Dan Carpenter Signed-off-by: Linus Torvalds --- diff --git a/mm/mmap.c b/mm/mmap.c index f90ea92f755a..456ec6f27889 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -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);