[openib-general] [PATCH] ib_uverbs_get_context does not unlock file->mutex in error path

CH Ganapathi cganapathi at novell.com
Thu Jun 8 05:12:14 PDT 2006


Hi,

If ibdev->alloc_ucontext(ibdev, &udata) fails then
ib_uverbs_get_context
does not unlock file->mutex before returning error.

Thanks,
Ganapathi
Novell Inc.


Signed-off by: Ganapathi CH <cganapathi at novell.com>

Index: linux-kernel/infiniband/core/uverbs_cmd.c
===================================================================
--- infiniband/core/uverbs_cmd.c	2006-06-08 11:52:29.000000000
+0530
+++ infiniband-fix/core/uverbs_cmd.c	2006-06-08 17:16:10.000000000
+0530
@@ -80,8 +80,10 @@ ssize_t ib_uverbs_get_context(struct ib_
 		   in_len - sizeof cmd, out_len - sizeof resp);
 
 	ucontext = ibdev->alloc_ucontext(ibdev, &udata);
-	if (IS_ERR(ucontext))
-		return PTR_ERR(file->ucontext);
+	if (IS_ERR(ucontext)) {
+		ret = PTR_ERR(file->ucontext);
+		goto err;
+	}
 
 	ucontext->device = ibdev;
 	INIT_LIST_HEAD(&ucontext->pd_list);





More information about the general mailing list