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>

authored by Rik van Riel and committed by Linus Torvalds 58927533 a231a1f2

+2 -1
+2 -1
mm/mmap.c
··· 1977 1977 return 0; 1978 1978 1979 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 1982 if (new->vm_file) { 1982 1983 if (vma->vm_flags & VM_EXECUTABLE) 1983 1984 removed_exe_file_vma(mm);