aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorRik van Riel <riel@redhat.com>2010-04-26 12:33:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-27 11:26:51 -0400
commit5892753383090a3eddf0e1b043c95e3b2c7feda5 (patch)
treef1a1d3b449f275dd34ba34208704e92900032f9b /mm/mmap.c
parenta231a1f2714ce3b28445ac512a556d6c95517dab (diff)
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 <riel@redhat.com> Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c3
1 files changed, 2 insertions, 1 deletions
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,
1977 return 0; 1977 return 0;
1978 1978
1979 /* Clean everything up if vma_adjust failed. */ 1979 /* Clean everything up if vma_adjust failed. */
1980 new->vm_ops->close(new); 1980 if (new->vm_ops && new->vm_ops->close)
1981 new->vm_ops->close(new);
1981 if (new->vm_file) { 1982 if (new->vm_file) {
1982 if (vma->vm_flags & VM_EXECUTABLE) 1983 if (vma->vm_flags & VM_EXECUTABLE)
1983 removed_exe_file_vma(mm); 1984 removed_exe_file_vma(mm);