[openib-general] Re: missing check in uverbs?

Roland Dreier roland at topspin.com
Mon May 16 10:00:55 PDT 2005


    Michael> Hi, Roland!  I had a mix of an updated kernel level code
    Michael> (rev 2350) and an outdated userspace library. Running
    Michael> ibv_pingpong client I got the following:

Yep, we shouldn't allow userspace to perform mmap() until a userspace
context has been allocated.

Fixed by this (already checked in):

--- infiniband/core/uverbs_main.c	(revision 2349)
+++ infiniband/core/uverbs_main.c	(working copy)
@@ -389,7 +389,10 @@ static int ib_uverbs_mmap(struct file *f
 {
 	struct ib_uverbs_file *file = filp->private_data;
 
-	return file->device->ib_dev->mmap(file->ucontext, vma);
+	if (!file->ucontext)
+		return -ENODEV;
+	else
+		return file->device->ib_dev->mmap(file->ucontext, vma);
 }
 
 static int ib_uverbs_open(struct inode *inode, struct file *filp)



More information about the general mailing list