From: Gavin Lambert Date: Sun, 1 Oct 2006 06:27:01 +0000 (-0700) Subject: [PATCH] NOMMU: don't try and give NULL to fput() X-Git-Tag: v2.6.19-rc1~635 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fcd03e07008ec0f667dfb7626171165699ea5c2;p=linux-2.6 [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/nommu.c b/mm/nommu.c index 5645406621..365019599d 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -948,7 +948,8 @@ unsigned long do_mmap_pgoff(struct file *file, up_write(&nommu_vma_sem); kfree(vml); if (vma) { - fput(vma->vm_file); + if (vma->vm_file) + fput(vma->vm_file); kfree(vma); } return ret;