mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmap: check ->vm_ops before dereferencing
       [not found] <20100426100305.GP29093@bicker>
@ 2010-04-26 16:33 ` Rik van Riel
  0 siblings, 0 replies; only message in thread
From: Rik van Riel @ 2010-04-26 16:33 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-mm, linux-kernel, akpm, torvalds

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>

diff --git a/mm/mmap.c b/mm/mmap.c
index f90ea92..456ec6f 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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-04-26 17:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20100426100305.GP29093@bicker>
2010-04-26 16:33 ` [PATCH] mmap: check ->vm_ops before dereferencing Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®