Browse Source

[PATCH] NOMMU: don't try and give NULL to fput()

Don't try and give NULL to fput() in the error handling in do_mmap_pgoff()
as it'll cause an oops.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Gavin Lambert 18 years ago
parent
commit
3fcd03e070
1 changed files with 2 additions and 1 deletions
  1. 2 1
      mm/nommu.c

+ 2 - 1
mm/nommu.c

@@ -948,7 +948,8 @@ unsigned long do_mmap_pgoff(struct file *file,
 	up_write(&nommu_vma_sem);
 	up_write(&nommu_vma_sem);
 	kfree(vml);
 	kfree(vml);
 	if (vma) {
 	if (vma) {
-		fput(vma->vm_file);
+		if (vma->vm_file)
+			fput(vma->vm_file);
 		kfree(vma);
 		kfree(vma);
 	}
 	}
 	return ret;
 	return ret;