public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ehca: fix do_mmap() error check
@ 2006-12-19  8:43 Akinobu Mita
  2006-12-19  9:32 ` Hoang-Nam Nguyen
  2006-12-19 11:35 ` mmap abuse in ehca, was " Christoph Hellwig
  0 siblings, 2 replies; 7+ messages in thread
From: Akinobu Mita @ 2006-12-19  8:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Hoang-Nam Nguyen, Christoph Raisch

The return value of do_mmap() should be checked by IS_ERR().

Cc: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
Cc: Christoph Raisch <raisch@de.ibm.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

---
 drivers/infiniband/hw/ehca/ehca_uverbs.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: 2.6-mm/drivers/infiniband/hw/ehca/ehca_uverbs.c
===================================================================
--- 2.6-mm.orig/drivers/infiniband/hw/ehca/ehca_uverbs.c
+++ 2.6-mm/drivers/infiniband/hw/ehca/ehca_uverbs.c
@@ -321,14 +321,14 @@ int ehca_mmap_nopage(u64 foffset, u64 le
 		     struct vm_area_struct **vma)
 {
 	down_write(&current->mm->mmap_sem);
-	*mapped = (void*)do_mmap(NULL,0, length, PROT_WRITE,
+	*mapped = (void*)do_mmap(NULL, 0, length, PROT_WRITE,
 				 MAP_SHARED | MAP_ANONYMOUS,
 				 foffset);
 	up_write(&current->mm->mmap_sem);
-	if (!(*mapped)) {
+	if (IS_ERR(*mapped)) {
 		ehca_gen_err("couldn't mmap foffset=%lx length=%lx",
 			     foffset, length);
-		return -EINVAL;
+		return PTR_ERR(*mmaped);
 	}
 
 	*vma = find_vma(current->mm, (u64)*mapped);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-01-05  8:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-19  8:43 [PATCH] ehca: fix do_mmap() error check Akinobu Mita
2006-12-19  9:32 ` Hoang-Nam Nguyen
2006-12-19 11:35 ` mmap abuse in ehca, was " Christoph Hellwig
2006-12-20  8:36   ` do we have mmap abuse in ehca ?, was Re: mmap abuse in ehca Christoph Raisch
2006-12-20 11:51     ` Christoph Hellwig
2007-01-04 21:20       ` Roland Dreier
2007-01-05  8:17         ` Christoph Raisch

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